The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Checking the header and trailer for a given string and if not found, exit out of the er_ashu UNIX for Dummies Questions & Answers 2 11-08-2007 09:55 AM
Copy all the files with time stamp and remove header,trailer from file ksrams UNIX for Dummies Questions & Answers 35 07-30-2007 02:15 PM
Count No of Records in File without counting Header and Trailer Records guiguy Shell Programming and Scripting 2 06-07-2007 12:15 PM
Strip 3 header lines and 4 trailer lines ganesh123 Shell Programming and Scripting 9 03-10-2007 05:15 PM
Remove header(first line) and trailer(last line) in ANY given file madhunk Shell Programming and Scripting 2 03-13-2006 03:36 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-06-2008
balzzz balzzz is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 8
Append Header and Trailer

Hi everyone,

I am new to Unix programming. My inquries is:-
a) How to add a Header and Trailer in the set of data
b) Include a number count of the data in the trailer

The set of data only contained the information of 'Customer's Name' and 'Account Number'. I would like to add the Header and a Trailer to the sets of data.

Hope you all will be able to assist me. Appreciate it alot.
Thanks
  #2 (permalink)  
Old 01-06-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
Search google for some basic awk tutorial.
  #3 (permalink)  
Old 01-06-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,509
Quote:
Originally Posted by balzzz View Post
Hi everyone,

I am new to Unix programming. My inquries is:-
a) How to add a Header and Trailer in the set of data
depending on what you mean by header and trailer, if
1) you want to add header/trailer to a file, basic shell operations like >> may suffice,eg
Code:
# echo "header" > newfile
# cat dataset >> newfile
# echo "trailer >> newfile
2) if you want to add header/trailer to records in a file
Code:
while read line
do
 echo "header $line trailer"
done  < "dataset" > newfile
Quote:
b) Include a number count of the data in the trailer
for that, i leave it to you to find out yourself

Last edited by ghostdog74; 01-06-2008 at 08:31 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0