PLZ help..!!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers PLZ help..!!
# 1  
Old 05-31-2010
Error help me with seperating the no. of fields..

plz help me with this question :

1111 | aaaa | pppp | 23/9/87
3333 | dddd | oooo | 6/9/8
4444 | gggg | rrrr | 5/8/9
5555 | qqqq | eeee

ans:

5555 | qqqq | eeee

depending upon how many "|" are in the question

be quick..

Last edited by adityamitra; 05-31-2010 at 09:18 AM..
# 2  
Old 05-31-2010
And the question would be ...?
# 3  
Old 05-31-2010
Code:
awk -F'|' 'NF == 3' file

Smilie
# 4  
Old 05-31-2010
the question is :
1111 | aaaa | pppp | 23/9/87
3333 | dddd | oooo | 6/9/8
4444 | gggg | rrrr | 5/8/9
5555 | qqqq | eeee

---------- Post updated at 04:33 PM ---------- Previous update was at 04:32 PM ----------

Quote:
Originally Posted by pseudocoder
Code:
awk -F'|' 'NF == 3' file

Smilie

can you do it with either grep or sed.. plz..
# 5  
Old 05-31-2010
1) You still haven't told us what you want to do. And a bunch of lines of input data is not a question!
2) What's wrong with the awk solution? Is this homework?
# 6  
Old 05-31-2010
Quote:
Originally Posted by pludi
1) You still haven't told us what you want to do. And a bunch of lines of input data is not a question!
2) What's wrong with the awk solution? Is this homework?
1) that is a question.. iam trying different things
2) it is not hw.. just in a hurry 2 learn unix..
my project is on it... so hurry
# 7  
Old 05-31-2010
  1. No, this is not a question. A question would be a sentence describing your situation and what you need help with, usually terminated with a question mark ('?'). What you gave us so far are a few lines that could be either input or output to/from a program, with no indication of what kind of operation you want to apply to it.
  2. If it's not homework, what's wrong with the awk solution? It does solve your situation (as far as we could infer) quite efficiently.

Also, please change the subject of this thread to something more descriptive. Descriptive would be if someone reads the subject they know whether or not they'll be able to help.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help me plz

can you help me to answer these questions ... Q1 - Write shell script to print the following pattern: 1 22 333 4444 55555 Q2- Write shell script to compare the strings, check and see if a command line argument matched the string "net321" print on screen "** string matches ** " if... (3 Replies)
Discussion started by: last exile
3 Replies

2. Shell Programming and Scripting

plz help me

hi... i want to print the below format by using shell scripting...plz help me 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Thanking u in advance... regards ram (1 Reply)
Discussion started by: ram_pl
1 Replies

3. Shell Programming and Scripting

plz help me

this script reads source.txt and move and random choice 6 files among 25 txt file and renmame it.. but it is not executed.. whats problem? #!/bin/ksh while read line do cd $line/radmin num=0 /bin/ls *.txt | while read file_nm ; do (( check = $RANDOM % 2 )) if ; then continue... (1 Reply)
Discussion started by: topic32428285
1 Replies

4. Solaris

can anyone help plz

hi I have been given a new Sun fire V120 which i had no use for but my firend wished to host a maple story sever on it so i was happy to let him use it but i have run in to the problem that i have no clue how to configure it so he can use it if anyone can help we would realy appreciate it. Am... (1 Reply)
Discussion started by: rdsars
1 Replies

5. Shell Programming and Scripting

Plz help

I am a newbie to Unix, I am using vi editor. I was able to print output to the screen using simple scripts. But when I tried a midlevel script I don't see anything on the screen and Cursor is just blinking when I type ./test11 filename. I have used chmod 755 also, but of no use. Any help would... (3 Replies)
Discussion started by: Mandab
3 Replies

6. UNIX for Dummies Questions & Answers

plz help me

how i can download the game plz tell me ????? ty :) :) :) (3 Replies)
Discussion started by: Sora21
3 Replies

7. Programming

plz help

alright, i just got this assignment. since im very new to unix programming, i would like to have some ideas about it. honestly, i dont even know what the hell he is asking for. plz see the attached pdf and help me out. thank you :( (2 Replies)
Discussion started by: ligerdave
2 Replies

8. Programming

plz help!

i'm pretty new to unix programming. i just wanna know how exactly fork(), waitpid() works. i have read some from the book, but it's still confusing. especially with those < 0 and == 0. plz help!!!! (1 Reply)
Discussion started by: ligerdave
1 Replies

9. UNIX for Dummies Questions & Answers

plz Help How should I configure cc compiler output file plz help???

i.e configuration of C compiler :confused: (4 Replies)
Discussion started by: atiato
4 Replies
Login or Register to Ask a Question