getdpg
February 1, 2006, 11:41am
1
i want to format the file with tab delimitaed and assign heading to each column .
my format of file is
7 aiss 10
8 linux 25
9 linux_10for 35
Ouput i want like this
Ver Host Fails
7 aiss 10
8 linux 25
9 linux_10for 35
awk 'BEGIN {
printf ("Ver\tHost\tFails\n")
}
{
printf ("%s\t%s\t%s\n",$1,$2,$3);
}' filename
getdpg
February 1, 2006, 1:01pm
3
i need to do through shell script
i am generating file by shell script
and want to format through that
i wrote shell script in /usr/bin
i want to open file as cat and do changes and save it again
ok, you need to add the above contents in a file, give it permissions u+x and then execute the shell script.
to edit the file use some editor like vi. cat is not really a editor. it is a command GENERALLY used to see the contents of a file.
getdpg
February 2, 2006, 12:20pm
5
yeah but how i will modify the file and save through shell script .
i generate the file through shell script . i want to format that file with tab and heading of file
can you give soultion
assuming files are generated through script
for file in <every file generated through script>
do
apply linuxpenguin's solution ; redirect the output to $file.diff (another file)
done
is this what u mean ?