Unix Linux Shell To Add Delim With SED And Cut

The following shell script shows how * Use At Own Risk

cat text_delim.sh #!/bin/sh FILE=$1 # pass file names as args # pass unique string or hardcode # UNIQUE='url=http' # if [ -z "$FILE" ]; then exit; fi; # $UNIQUE is replaced with '| url=http' in loop below # for LINE in `sed "s/ /$UNIQUE/g" $FILE`; do LINE=`echo $LINE | sed "s/$UNIQUE/ | url=http/g"`; echo $LINE; done; # cut delim | field 2 and output to test2 file below cut d'|' -f2 test1 > test2 exit;

To run The following shell script enter

sh text_delim.sh test > test1 * this will use file test as input and create test1 and test2 as output *
Go Back to:
http://Howes-IT-Going.com

This Webpage and Contents Created by Steven C. Howes © Howes-IT-Going 2009-2012 All Rights Reserved.