![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to view the contents of .gz file without extracting the file? | amitkhiare | Shell Programming and Scripting | 5 | 10 Hours Ago 11:29 AM |
| search for the contents in many file and print that file using shell script | cdfd123 | Shell Programming and Scripting | 3 | 10-07-2007 07:17 PM |
| append file name contents to a target file | gopskrish | UNIX for Dummies Questions & Answers | 2 | 10-27-2006 03:18 AM |
| Reading specific contents from a file and appending it to another file | dnicky | Shell Programming and Scripting | 5 | 10-04-2005 02:45 AM |
| ls contents of a file | douknownam | Shell Programming and Scripting | 7 | 06-14-2004 06:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#22
|
||||
|
||||
|
See the pattern below.
Code:
IFS=;
while read continent country city id address date
do
ID=$id
CONTINENT=$continent
COUNTRY=$country
CITY=$city
DATE=$date
header $ID
body1 $CONTINENT $ID
done < $INPUTFILE
Code:
function header {
OUTPUTFILE="$OUTPUTFILE.$1"
echo "$HEADER" > $OUTPUTFILE
echo "$1" >> $OUTPUTFILE
echo "\">" >> $OUTPUTFILE
}
function body1 {
OUTPUTFILE="$OUTPUTFILE.$2"
echo "$1" >>$OUTPUTFILE
echo "$continent" >>$OUTPUTFILE
echo "</info1>" >>$OUTPUTFILE
}
|
||||
| Google The UNIX and Linux Forums |
| Forum Sponsor | ||
|
|