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 > 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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reading the header of a tar file(posix header) Tanvirk Linux 2 01-31-2008 08:50 AM
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
Count string at header. Helmi Shell Programming and Scripting 13 04-25-2007 07:16 AM
inserting a String in the file(s) 2tbee Shell Programming and Scripting 4 04-11-2006 05:36 AM
Inserting new line after match of a fixed string sunil_neha Shell Programming and Scripting 6 04-13-2004 11:09 AM

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

Join Date: Dec 2007
Posts: 3
Inserting a String in a file header.

Dear all,

I have a file created in the name sample.txt in UNIX with header and footer. How to insert a required string (for example "FILE1") in the header part after the file has been created. What kind of command can i use to do the same.

Thanks in advance
Hari
  #2 (permalink)  
Old 05-14-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,420
man sed
Code:
sed '1 s/$/FILE1\n/' file
  #3 (permalink)  
Old 05-14-2008
Hari123 Hari123 is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 3
Can we include spaces in that sed command??

Thanks
hari
  #4 (permalink)  
Old 05-14-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Try it, and be amazed.
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 08:40 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