How to padd the words in unix script.... Help required

Reply

Join Date: Oct 2006
Posts: 13
Reputation: madankumar is an unknown quantity at this point 
Solved Threads: 0
madankumar madankumar is offline Offline
Newbie Poster

How to padd the words in unix script.... Help required

 
0
  #1
Dec 19th, 2007
HI

I would likt to create input files for testing, format is like this

INPUT Format

DISP NUM BYTES Desc
0 4 CODE
4 10 EMP NO
14 3 AGE
17 1 SEX

which will be used for creating flat files ( data in excel file).

OUTPUT file should be continous like

CODE19239625M

like this

Here CODE is the EMPCODE, 192396 is EMPNO, 25 is the AGE and M is SEX.

Can anyone will lead me to write the script ......... PLZ help
Madan Kumar T
Bangalore.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: How to padd the words in unix script.... Help required

 
0
  #2
Dec 20th, 2007
Hey There,

I'm not sure if you want to create input files or parse input files to put into excel spreadsheet format. If you want the output to be continuous, is each continuous output segment going to be a cell in excel?
Just curious. It's easy enough to grab the information and print it with no spaces in between. Also, if you want excel to pick up your file output by just calling your text file whatever.xls, you should separate the different fields with a common excel separator (the ones they suggest when you import a text file) like a pipe (|) or comma (,). I've always used pipes and it's worked out well.

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,285
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 244
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: How to padd the words in unix script.... Help required

 
0
  #3
Dec 20th, 2007
As I said, check out the man pages for printf.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC