Output every certain lines.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output every certain lines.
# 1  
Old 04-06-2006
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 # being displayed
First Name Lastname (seperate field)
Data (seperate field)


Prefered output will look like.

Record ==> 1
Firstname lastname
data


Records ==> 4
Firstname lastname
data.
# 2  
Old 04-06-2006
Please read our rules which state:

(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post where your goal is to get an answer more quickly.

and

(6) Do not post classroom or homework problems.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract lines from output

Hi everyone, I have the following string that repeats in a file. I want to get the following output : "CDN_NF2_SGW_INT_443" 172.23.120.40:443 source-address-translation { pool /Common/SNAT_EXTERNAL_62.179.94.194 and parse the file till the end . (3 Replies)
Discussion started by: liviusbr
3 Replies

2. 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

3. UNIX for Dummies Questions & Answers

output only some lines of a file

Hi, I would like to know how can I output only the lines of a file (file1) corresponding to the numbers present in another file (file2). Example file1: aetteg bgrhet cgegeg ddfggg Example file2: 1 3 4 Desired output file: aetteg cgegeg ddfggg (7 Replies)
Discussion started by: fadista
7 Replies

4. UNIX for Dummies Questions & Answers

How to parse 2 particular lines from Command output

Hi All, I need help on the following req. I am getting output of a command as follows: 16377612 total memory 3802460 used memory 2827076 active memory 681948 inactive memory 12575152 free memory 477452 buffer memory I want to compute used... (1 Reply)
Discussion started by: mailsara
1 Replies

5. Shell Programming and Scripting

How to filter only the last 'n' lines of a grep output?

I am running a grep query for searching a pattern, and the output is quite huge. I want only the last 200 lines to be displayed, and I am not sure if tail will do the trick (can tail read from std in/out instead of files?). Please help me out. (1 Reply)
Discussion started by: shell_newbie
1 Replies

6. Shell Programming and Scripting

deleting last n lines from a output

Friends, I am executing this command in solaris sar -d 3 3 | awk 'NR > 2 { if ($1 !~ /,.+/) print }' | egrep -v "nfs|device" . Now i want to delete the last two lines of my output as they are records of average which i don't want. can some one pls give me some idea on how to proceed. (7 Replies)
Discussion started by: achak01
7 Replies

7. Shell Programming and Scripting

Execute the Output Lines.

Hi, My Script looks like this #! /bin/ksh cd /usr/SrcFiles/ADD; while read line do d=`echo $line|cut -d'.' -f1` echo $d".XML" >> XML_File_List.txt out=`echo "gunzip -c -S .ZIP $d.ZIP > $d.XML;"` echo $out per=`echo "chmod ugo+rwx $d.XML;"` echo $per done <ZIP_File_List.txt and the... (5 Replies)
Discussion started by: naveen.kuppili
5 Replies

8. Shell Programming and Scripting

Execute output lines

I have a command (not shell script) that general several lines of output like this... scp /var/lib/mysql/jitu/email.* root@172.29.0.218:/root/pitu/ scp /var/lib/mysql/jitu/orders.* root@172.29.0.218:/root/pitu/ I tried adding xargs but it did not work. -exec was not tried because I guess it... (3 Replies)
Discussion started by: shantanuo
3 Replies

9. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: CFIL
4 Replies

10. Shell Programming and Scripting

GREP:Output all lines containing word

Output all lines in the file temp that contain the word dog using GREP only and in one line!!! I tried grep ']dog]' temp but it doesnt catch word dog when is at beginning or end, like: Our dog is nice /this OK Nice dog /this NOT dog good /this NOT Thank... (3 Replies)
Discussion started by: ljubayuu
3 Replies
Login or Register to Ask a Question