The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 12-02-2007
bakunin bakunin is online now
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,292
Thats quite straightforward. Find a script skeleton below:

Code:
#! /bin/ksh
typeset    fInput="/data/m/b.csc"      # input filename
typeset    fOutput="/data/o/tran.csv"  # output filename

if [ -r "$fInput" ] ; then     # perhaps there should be more input validation
     print -u2 "unable to read input file"
     exit 1
fi

sed 's/^\([^,]*,[^,]*,[^,]*,\)\([0-9]\{1,5\}\),/\1000\2/
     s/^\([^,]*,\)[^,]*,\([^,]*,[^,]*,[^,]*,\)[^,]*,\([^,]*\).*$/\1\2\3/' $fInput > $fOutput

exit $?
Hope this helps.

bakunin
Reply With Quote