[NTLUG:Discuss] YAS Yet Another Script
Wrenn, Bobby J.
Bobby.Wrenn at banctec.com
Fri Oct 12 09:01:52 CDT 2001
Well, that mostly worked. The input ".csv" file has several lines which look
like this:
A3189A,1,HP 9000 K460 Upgrade
The output file looks like this:
CPSUB BTEC AMER K420,
for as many lines as are in the input file.
What I need is lines like this:
CPSUB BTEC AMER K420,A3189A,1,HP 9000 K460 Upgrade
for each line in the input file.
Here is the original script:
#!/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
I think I see the problem. Which means I may be actually learning something.
The echo line calls the variable $line. But I don't see it either defined or
read.
Here is a suggestion for a presentation "Regular Expressions" and "Shell
Scripting".
Thanks again,
Bobby
More information about the Discuss
mailing list