![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using find command for timestamp based search | sunny_03 | UNIX for Dummies Questions & Answers | 1 | 02-12-2008 02:38 AM |
| String search - Command to find second occurance | saurabhsinha23 | UNIX for Dummies Questions & Answers | 5 | 12-06-2007 05:03 PM |
| grep with find to search for matchiing words | akhil313 | UNIX for Dummies Questions & Answers | 1 | 12-12-2006 07:18 AM |
| search in a directory using grep command | malaymaru | Shell Programming and Scripting | 4 | 05-23-2005 06:45 AM |
| search for hardlinks based on filename via find command | hunternjb | UNIX for Dummies Questions & Answers | 2 | 03-26-2001 09:07 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Search / Find / grep command ...
Is there any command, so I can retrieve all the records in a file from the first occurance of a search string, within that file?
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I would say,
'NO' to retrieve all the patterns just from the first occurrence of the search string from a file Code:
grep ^pattern file If I havent understood your req, then I need to rethink |
|
#3
|
|||
|
|||
|
Ok, let me be clear in my question.
A,1 B,2 C,3 D,4 E,5 If I search for C, then I should get output as below, C,3 D,4 E,5 grep ^C file, is returning me only 1 row. It is not helping me. |
|
#4
|
|||
|
|||
|
this is clear
Code:
awk '/^C/, /\$/ {print }' file
|
|
#5
|
|||
|
|||
|
Thanks, it works as expected.
|
|||
| Google The UNIX and Linux Forums |