[NTLUG:Discuss] YAS Yet Another Script
Paul Ingendorf
pauldy at wantek.net
Thu Oct 11 18:35:18 CDT 2001
Try this out. On a test dir of course.
#!/bin/bash
for file in *.csv
do
basefile=`basename "$file" .csv`
for lines in `cat "$file" | sed -e "s/ /__/g"`
do
echo "$basefile,$line" | sed -e "s/__/ /g" >> "$basefile.asc"
done
done
Quoting Bobby Wrenn <bobby at wrennest.com>:
> This is not a direct Linux question. So, feel free to reply off list.
> This is the only place I know to ask the question.
>
> I have a bunch (208) files with names like this "CPSUB BTEC SILSP
> V22.csv". Each file has lines like this:
> A5081A,1,V2250 Base System Configuration
> A5066A,6,V Class 240MHz PA8200 CPU w 4MB Cache
>
> I need to prepend the file name and a comma to each line of the file
> and
> output to another file with a name such as "CPSUB BTEC SILSP V22.asc".
>
> TIA
> Bobby
>
> --
> This tagline is identical to the one you are reading.
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
--
-->> mailto:pauldy at wantek.net
-->> http://www.wantek.net/
Running ....... Cos anything else would be a waste...
`:::' ....... ......
::: * `::. ::'
::: .:: .:.::. .:: .:: `::. :'
::: :: :: :: :: :: :::.
::: .::. .:: ::. `::::. .:' ::.
.:::.....................::' .::::..
More information about the Discuss
mailing list