hi
I unload the table results from oracle to csv file foramt.
i need increse the width of each column using unix commands
could you pl tell me how to increase the width of each column to spefic width uisng sed unix command or na other unix commands
i have file name called report.csv
inside this file
here is the contents
here are record of csv file
pl tell me how to increase the column width from this.
aaaaaaaaaaa,bbbb,cccccccccc,dddd,eeeeeeeeeeee
bbbbb,ccccc,zzzzzzzzzzz,vvvvvvvvv,mmmm
Thanks for your quick reply.
i am sorry about that.
i want to incrase all the columns and all the records in that file
the result should be in new file.
i want increase right of each column around 15 positions on the first column,
5 postions on 2nd column, 4 positions on 3rd column, 4th and 5th sould be 2 postions.
NO.
what is my problem is i sent this CSV FILE to excel spread sheet.
when open the csv file, i could not see whole column width. it showing excel default column width. so, i cannot see whole column. i need to manually darg he column to see column result. so, i want to increase the column width before sening to e-mail attachment.
that is my problem.
Dear raosurya, (as someone used to say)
Pls do a little experiment:
take your .csv file
hand edit one of the fields - increase the 'padding' to the desired length
save the .csv file
bring the .csv file in Excell
see if your columns have adjusted their 'width'
if they did - it's worth writing a 'script'. if they ain't - it ain't. It's got nothing to do with padding, but rather the Excell way of adjusting the width.
Raosurya,
As you know, we are all unix volunteers here and we are here
to help people solve their problems.
But under no circunstances we work under pressure.
You have to give members a chance to work on your issue keeping
in mind the following:
"Lack of planing on your side does not constitute emergency on our side"
In any event, here is your solution:
while read mLine
do
set -- `echo $mLine | sed 's/,/ /g'`
printf "%-15s %-5s %-4s %-2s %-2s\n" $1 $2 $3 $4 $5
done < input_file
I don't think that padding with spaces will help, since Excel will still use a default column width when opening a csv file. You could convert your csv file to html, which Excel will try to render properly, e.g....
after i ran the script,
i got no attchment of any file.
what could be the problem.
here is my code:
spool /test/out/report.csv
select name ||','||
status ||','||
begin||','||
end||','||
from emptab
where name
a.name =b.name
order by name;
spool off
i got this resulst into csv file
then i code
Hi shell life
here is you written.
while read mLine
do
set -- `echo $mLine | sed 's/,/ /g'`
printf "%-15s %-5s %-4s %-2s %-2s\n" $1 $2 $3 $4 $5
done < input_file
but, i need output in to another file,
what is use of set --( two dashes here ). pl explain.
thx. N.