Suppressing one line in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Suppressing one line in a file
# 1  
Old 06-29-2006
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  
Old 06-29-2006
Suppress line 1
Code:
sed "1d" in.txt > out.txt

Suppress line 1 and 2
Code:
sed "1,2d" in.txt > out.txt

# 3  
Old 06-29-2006
Code:
grep -v "^account1" file > newfile (without account1)

# 4  
Old 06-29-2006
An awk solution:

Suppress first line:
Code:
awk 'NR > 1' file1 > file2

Suppress first two lines:
Code:
awk 'NR > 2' file1 > file2

# 5  
Old 06-30-2006
or
Code:
tail -n $(( $(cat z.dat|wc -l) - 1)) infile > outfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Suppressing errors from command output

Hi, When I run the command "print_manifest | grep "Main Memory", I get the note : # /opt/ignite/bin/print_manifest | grep "Main Memory" NOTE: Could not read the /etc/resolv.conf file. Main Memory: 196498 MB # How do I suppress the part : NOTE: Could not read the... (4 Replies)
Discussion started by: anaigini45
4 Replies

2. Shell Programming and Scripting

Suppressing carriage return in bash alias

I'd like to create an alias that displays my string but leaves my cursor at the end. Not seeing any examples of this. One indirect way might be to preload or stuff the history buffer, so I just hit up arrow. (2 Replies)
Discussion started by: tns1
2 Replies

3. Shell Programming and Scripting

Suppressing the terminated message from pkill & killall commands in a bash script

Hi all, I've been pulling my hair out with this problem for 3 days:wall: now without success any help would be massively appreciated. Basically the script is used to shutdown a rails server so a new IP address can be assigned, the shutdown part is taken care of in function_one using the... (2 Replies)
Discussion started by: danmc
2 Replies

4. Shell Programming and Scripting

Suppressing a message from being displayed

I have a script which checks for *.txt files in a particular directory and if no files were found then it goes into sleep for 10 secs and looks back for files again and if any files were found then the script does some processing with the files found, which is my requirement too. FILE_EXISTS=`ls... (5 Replies)
Discussion started by: vpv0002
5 Replies

5. Red Hat

Suppressing Error Message is not working

I need to suppress the error message for commands. I have given the command like below lsb_release -dr 2>/dev/null But it is not working. Am testing with Red Hat Linux release 9. Guide me. Thanks in advance (2 Replies)
Discussion started by: forumguest
2 Replies

6. Shell Programming and Scripting

Suppressing output of a spawned telnet process

Hi, I'm trying to spawn a telnet process and trying to do some actions in the remote host using expect script. I would like to know how to suppress all the output in order the user using the script should not be able to see any actions done on the remote host. I tried using the "log_user 0"... (8 Replies)
Discussion started by: arun_maffy
8 Replies

7. Shell Programming and Scripting

Suppressing space replacing by comma

hi i want to replace spaces by comma my file is ADD 16428 170 160 3 WNPG 204 941 No 204802 ADD 16428 170 160 3 WNPG 204 941 No 204803 ADD 16428 170 160 3 WNPG 204 941 No 204804 ADD... (9 Replies)
Discussion started by: raghavendra.cse
9 Replies

8. UNIX for Dummies Questions & Answers

echo is suppressing multiple spaces.How to avoid it

I am reading a file and copying selected lines from the file into another using echo. For eg: while read line do if ((some logic to determine whether I need to copy the current line to another file)) then echo $line > tempfile fi done<srcfile The problem I have is the data in the file... (1 Reply)
Discussion started by: prathima
1 Replies

9. UNIX for Dummies Questions & Answers

Suppressing output to the screen

I want to check whether the variable read from the console is number or character , so i used echo $option|grep and checked the reuslt returned by grep cmd using $? But since I use echo the value is getting printed in the screen , I want to supress the o/p. Can anyone suggest how this can be... (1 Reply)
Discussion started by: rolex.mp
1 Replies

10. Shell Programming and Scripting

suppressing keyboard input

Setup Info: This User Id and Password mention below are being used with the ISQL command to connect to a sybase database so they are likely to not be the same as those that were signed on from the session. Situation: Using a korn shell, the shell prompts for a User Id and Password. During the... (1 Reply)
Discussion started by: anthreedhr
1 Replies
Login or Register to Ask a Question