The UNIX and Linux Forums  

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


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #22  
Old 02-24-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,698
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
}
$@ will change to $1 and $2, whereever appropriate.
Reply With Quote
Google The UNIX and Linux Forums
Forum Sponsor
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0