![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can i read a file character by character | karnan | Shell Programming and Scripting | 6 | 05-18-2008 11:22 PM |
| Count the number of occurence of perticular word from file | rinku | Shell Programming and Scripting | 40 | 08-10-2007 04:33 PM |
| Can I read a file character by character? | murtaza | Shell Programming and Scripting | 3 | 03-29-2007 08:19 AM |
| First Occurence | kkm_job | UNIX for Advanced & Expert Users | 5 | 10-30-2006 02:37 PM |
| Pattern occurence in a file | videsh77 | UNIX for Dummies Questions & Answers | 5 | 12-10-2004 03:41 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
First occurence of character in a file
Hi All
I have the following contents in a file say in a file name called 'FILE1' *********** Start of the file ************** SANDIO000456GROJ8900 SANDIO2338923GRJH900 *********** End of the file ******************* I want to cut the first line which has the characters. You may note that few lines of the file has blank lines in the start. Only after few lines you can see the strings. In this case i want to get SANDIO000456GROJ8900. Will this be possible in sed ? (Any direct single line command is appreciated) Regards Dhana |
| Forum Sponsor | ||
|
|
|
|||
|
First, that's Useless use of cat , second your snippet don't work. Maybe:
Code:
sed -n '/^[A-Z]/p' filename | head -1 |
| Thread Tools | |
| Display Modes | |
|
|