Summary: Help for formatting using scripting

From: himanshukhona (himanshukhona@indiatimes.com)
Date: Tue Feb 11 2003 - 00:37:57 EST


Hey,

Thanks to everyone who replied. Infact many people replied with almost identical answers.

awk '{printf "%8d %8d %8d %8d %8d\n", $1, $2, $3, $4, $5}' <My_file_name>

The above one liner worked for me.

I hope this summary reaches the group as i had summarised earlier but it didn't reach the group. If you get it twice pls excuse me.

Regards

Himanshu

"Kovacs, Gyula" wrote:

Hi,

cat | awk '{printf "%8d %8d %8d %8d %8d\n", $1, $2, $3, $4, $5}'

Regards,

--Gyula

-----Original Message-----
From: himanshukhona [mailto:himanshukhona@indiatimes.com]
Sent: Saturday, February 08, 2003 6:21 AM
To: sunmanagers@sunmanagers.org
Subject: Help for formatting using scripting

Hey all,

I have a file with say 5 columns with integers in all of them.
I need to write a script which will modify the file such that each of the
number is written with default 8 spaces allocated to it. For e.g. even if
the number is 962, it will be left alligned & use up 8 spaces

Its a small task. I tried many combinations of awk & printf.
Pls help.
TIA
Himanshu

Get Your Private, Free E-mail from Indiatimes at
http://email.indiatimes.com
Buy the best in Movies at http://www.videos.indiatimes.com
Bid for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to
http://airsahara.indiatimes.com and Bid Now !
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers

Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com
Buy the best in Movies at http://www.videos.indiatimes.com
Bid for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to http://airsahara.indiatimes.com and Bid Now !
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:25:47 EDT