help writing a unix to scripting

November 12, 2010 at 07:53:24
Specs: unix
i have a file with names in it lets call it a testfile.txt...
1. i want to make sure all the names are i was going to do this..
tr '[A-Z]' '[a-z]' testfile.txt > lowerfile.txt

2. i wante to add a *, to the front of each name and a ,*,* to the end of each name and i was able to do this by this line command..
cat lowerfile.txt | xargs -iz eacho "*," "Z" ",*,*" > newfile.out

3. wanted to name newfile.out to test(next number available) test1.out..test2.out what ever the next available number is ...and echo the output file is ......out

See More: help writing a unix to scripting

Report •

November 12, 2010 at 09:21:13
For number 3:

# add one to variable if using korn shell

# add one to variable using bourne shell
# cnt=`expr $cnt + 1`
# echo $cnt

# change cp to mv for rename
cp newfile.out test${cnt}.out

Report •
Related Solutions

Ask Question