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
echo is suppressing multiple spaces.How to avoid it prathima UNIX for Dummies Questions & Answers 1 04-29-2008 05:31 PM
Appending the line number and a seperator to each line of a file ? pjcwhite Shell Programming and Scripting 4 03-21-2007 01:29 AM
Suppressing output to the screen rolex.mp UNIX for Dummies Questions & Answers 1 02-08-2007 07:19 AM
Remove header(first line) and trailer(last line) in ANY given file madhunk Shell Programming and Scripting 2 03-13-2006 03:36 PM
suppressing keyboard input anthreedhr Shell Programming and Scripting 1 10-21-2004 11:05 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 06-29-2006
charbel charbel is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 41
Suppressing one line in a file

Hello there,

I am having a text file, the following is written in that text file:

Full range of accounts:

Account1
Account2
Account3
Account4


Now my question is. how to take that file and produce another file having only the accounts (i.e., suppressing the fist line of that file)....Any idea?
What about if i want to suppress two lines as well?

Tnanks for your help.
  #2 (permalink)  
Old 06-29-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Suppress line 1
Code:
sed "1d" in.txt > out.txt
Suppress line 1 and 2
Code:
sed "1,2d" in.txt > out.txt
  #3 (permalink)  
Old 06-29-2006
Doc_RuNNeR Doc_RuNNeR is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 17
Code:
grep -v "^account1" file > newfile (without account1)
  #4 (permalink)  
Old 06-29-2006
Glenn Arndt's Avatar
Glenn Arndt Glenn Arndt is offline Forum Advisor  
Anomalous Lurker
  
 

Join Date: Feb 2006
Location: Indianapolis, IN
Posts: 255
An awk solution:

Suppress first line:
Code:
awk 'NR > 1' file1 > file2
Suppress first two lines:
Code:
awk 'NR > 2' file1 > file2
  #5 (permalink)  
Old 06-30-2006
thestevew thestevew is offline
Registered User
  
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
or
Code:
tail -n $(( $(cat z.dat|wc -l) - 1)) infile > outfile
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 05:55 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