how can I choose output lines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how can I choose output lines
# 1  
Old 12-12-2008
how can I choose output lines

Hello,

I have a simple question, some scripts have information output on the first of command output such as:
>copyrights by CFIL v1.0
>
>1
>1
>1+1=2

How can I customize the output so I could delete the first line which has copyright line and also the second line which is blank

for example the command=
> cat output.txt | (choose line command)
and the new output will be=
>1
>1
>1+1=2

I will be grateful for your help Smilie

Best regards.
CFIL
# 2  
Old 12-13-2008

What are you really asking?

If all you want to do is remove the first two lines, there are several ways:, e.g.

Code:
sed '1,2d'

awk 'NR > 2'

{ read;read;cat; }

## etc. ...


# 3  
Old 12-13-2008
Hi,
tail can present information based on lines of output. For example, if You pipe Your output through

tail -n3

then You wont get the first two lines.

/Lakris
# 4  
Old 12-13-2008
Quote:
Originally Posted by Lakris
Hi,
tail can present information based on lines of output. For example, if You pipe Your output through

tail -n3

then You wont get the first two lines.

But then you will only get the last three lines. I think you meant:

Code:
tail -n +3

# 5  
Old 12-16-2008
cfajohnson and Lakris Thank you very much for your help and responses, it helped me a lot.

Best regards.
CFIL
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Which Product to Choose?

Okay, I have an Asus A8NSLI board with an Athlon 64 and I dunno, maybe 8gig Ram and Windows has crashed for the last time so I've finally had enough and I'll make it a Unix machine. I have a new 1Tera drive and I'm all set to go. Which brand of Unix/Linux can you advise me to go for? The... (3 Replies)
Discussion started by: abrogard
3 Replies

2. UNIX for Dummies Questions & Answers

How to choose the RIGHT PID?

I can find a single PID and copy it to a variable (thanks to the forum), but I have a slightly tougher situation: When a user logs into our system, it creates 5 processes example: root 21160 3096 0 07:16 ? 00:00:00 sshd: cs113 cs113 21164 21160 0 07:16 ? 00:00:00... (3 Replies)
Discussion started by: Igrok
3 Replies

3. Shell Programming and Scripting

Use sed to print first n lines and last n lines of an output.

Use sed to print first n lines and last n lines of an output. For example: n=10 Can it be done? Thanks. (7 Replies)
Discussion started by: carloszhang
7 Replies

4. What is on Your Mind?

Which Tablet to Choose?

Currently in the process of looking for a tablet. Which one is best? Thanks Benjamin Mauerberger (9 Replies)
Discussion started by: hlinks12
9 Replies

5. Shell Programming and Scripting

choose y or n

Hi, I have written a choice based shell script some thing like this: if (y) execute code .... fi else if(n) terminating the problem with the above scripting is it will work as far as the options are y or n. but i want to reiterate the same code when the user inputs something else... (1 Reply)
Discussion started by: sunrexstar
1 Replies

6. UNIX for Dummies Questions & Answers

ksh in vi mode, choose from output

is there a way to choose the complement from the output from the sequense in "ksh -o vi" root# ls testa testb root# cat tes 1) testa 2) testb root# cat tes <-- what to do now? this output looks like a select function, otherwise the numbers wouldn't make sense, is there a chance to use... (2 Replies)
Discussion started by: pressy
2 Replies

7. Shell Programming and Scripting

Output every certain lines.

I have a text file with 100 records. for example input file looks like: 1 firstname lastname address data 2 "' 3 "' 4 "" 5 "" 6 "" 7 "" 8 "' 9 "" 10 "" What i want for output. I want to get every 3rd line of above text file to be printed along with below info. Records #... (1 Reply)
Discussion started by: munnabhai1
1 Replies
Login or Register to Ask a Question