Parsing name and phone as input and then print sub and marks out


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Parsing name and phone as input and then print sub and marks out
# 1  
Old 07-20-2009
Parsing name and phone as input and then print sub and marks out

I have a file like this :
name phone id sub marks
abc 2345 45 mat 90
bgt 6573 54 eng 89
... .... .. ... ..
... .... .. ... ..



Now i need to take in name and phone as input and then print sub and marks out, can u give me a sample code for this.
P.S. If there are two of with same name and ph no: i need to take the latest one....PLZZZ help..!!!!

Last edited by SasankaBITS; 07-20-2009 at 09:57 AM..
# 2  
Old 07-20-2009
Next time use CODE-tags when displaying code, data or logs to enhance readability and to keep formatting like indention etc., ty.

What did you try so far? As a hint you might want to look up the read command and maybe the case command too. Or awk, cut, etc.

Also this "PLZZZ help!!!.." might give an advantage of getting help in World of Warcraft - here it does not and looks like children behaviour.

Last edited by zaxxon; 07-20-2009 at 10:45 AM..
# 3  
Old 07-20-2009
Was thinking about using line (sed -n <lineno:>p file.txt), but how do u find line number, given the two inputs???
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help on parsing Oracle RMAN output for string and print sections of a file

Hi, I need some advise on how to print 'sections' of the attached file. I am searching for some that says Marked Corrupt and print some lines after it. At the moment I am running the command below: sed -n -e '/Marked Corrupt/{N;N;p;}' rman_list_validate.txtThis gives me the following... (1 Reply)
Discussion started by: newbie_01
1 Replies

2. Shell Programming and Scripting

Parsing log file and print latest number in loop

Hello All, I have an awk script which parses my log file and prints number grepping from a specific line/pattern, now i have to come with a shell script to continue reading the log untill the job is completed, which i would know while reading session log untill process encounters a final... (1 Reply)
Discussion started by: Ariean
1 Replies

3. Shell Programming and Scripting

Need help in parsing an input in perl

I am executing a command it is returning me something like this name ip port ------------------------------------ http-listener-1 * 6712 http-listener-2 * 8709 I have a subroutine getListenerName($porttobeChecked) This subroutine returns me the name of the listener if i pass a... (4 Replies)
Discussion started by: javaholics
4 Replies

4. Shell Programming and Scripting

Parsing C Data Tipes from Input File

Im really beginner in this case, maybe someone can help me find the answer: if my input file like this: void main(int a, int b){ int x; double y; printf("file"); } and i want output like this: int a int b int x double y A awk script that can parse only data tipe, im confused. what... (2 Replies)
Discussion started by: radynaraya
2 Replies

5. Homework & Coursework Questions

Problem parsing input with awk

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I want add a line.For example:- 123456 1 1 0 1 1 0 1 0 0 0 1 5 8 0 12 10 25 its answer... (4 Replies)
Discussion started by: Arsh10
4 Replies

6. Homework & Coursework Questions

Shell: Parsing Input

1. The problem statement, all variables and given/known data: I'm fairly confident I can brute force this assignment, but let's not do that ;-). Basically I'm required to support input such as ps aux | grep blah >> blah.txt& echo 'slslslsl' My question is what is the best way to parse that... (4 Replies)
Discussion started by: someoney3000
4 Replies

7. Shell Programming and Scripting

Help parsing job script input parameters

I have a job script that runs with input parms from the command line. job.sh -p parm1_parm2_parm3_parm4_file_1.dat The parms are separated by _ The last parm is a file name and can have an _ in the name. I currently use the following commands to extract the parms parm1=`eval echo... (3 Replies)
Discussion started by: jclanc8
3 Replies

8. Shell Programming and Scripting

parsing file2 with input from file1

Sorry dublication with previous thread... please delete it Hi all i need and appreciate your help creating a script in ksh for the following case Two files exists with questionmark delemeter: File1.txt: A;B;C;F;D;K; File2.txt A,name,address1; K,name,surname,phone; C,name,phone;... (1 Reply)
Discussion started by: forumsgr
1 Replies

9. Shell Programming and Scripting

Parsing input paramter in a script

Hi folks I am having a little trouble in parsing a variable read into a ksh script I have a bunch of variables passed into script test.ksh HOST SERVER JOB1 JOB2 JOB3 JOB4 JOB5 What I want to do is read all the $JOB variables ($JOB1, $JOB2, $JOB3) into a variable and then read that variable... (2 Replies)
Discussion started by: Anubhav
2 Replies
Login or Register to Ask a Question