DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Shell Scripting (http://www.daniweb.com/forums/forum113.html)
-   -   How to padd the words in unix script.... Help required (http://www.daniweb.com/forums/thread101730.html)

madankumar Dec 19th, 2007 6:40 am
How to padd the words in unix script.... Help required
 
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

eggi Dec 20th, 2007 1:40 am
Re: How to padd the words in unix script.... Help required
 
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

masijade Dec 20th, 2007 2:19 am
Re: How to padd the words in unix script.... Help required
 
As I said, check out the man pages for printf.


All times are GMT -4. The time now is 12:58 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC