Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site




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

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,670
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