![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum 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 |
| Strip one line from 2 blank lines in a file | tipsy | Shell Programming and Scripting | 6 | 06-23-2008 05:14 AM |
| how to read a file till it encounters a blank line | adityam | Shell Programming and Scripting | 1 | 11-25-2007 11:15 PM |
| how to read a file till it encounters a blank line | adityam | Post Here to Contact Site Administrators and Moderators | 0 | 11-25-2007 10:51 PM |
| Deleting First Two Characters On Each Line | scotbuff | Shell Programming and Scripting | 5 | 12-15-2006 10:03 PM |
| how to get rid of blank line in a flat text file | xfang | Shell Programming and Scripting | 11 | 05-28-2003 12:08 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Deleting the blank line in a file and counting the characters....
Hi,
I am trying to do two things in my script. I will really appreciate any help in this regards.
Thanks a lot for help and time in this regards. Raj
__________________
Thanks Raj |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
sed -e '/^$/{$d;N;}' file1
Code:
grep "^C" file1 | wc -l Last edited by bhargav; 04-17-2005 at 12:19 AM. |
|
#3
|
||||
|
||||
|
The count process is better done as:
Code:
grep -c "C" file1 |
|
#4
|
|||
|
|||
|
Deleting the blank line in a file and counting the characters....
Thanks for replying on this.
I am sorry I potrayed the second part incorrectly. I need to count the letters for the words that starts with "C" in the first column in a pipe delimited file. Something like: C1213456| ---->this has 8 characters C123|---->this has 4 characters I have to pass this number to a variable..... Thanks again for the time and help.... Raj
__________________
Thanks Raj |
|
#5
|
||||
|
||||
|
Code:
nawk -F'|' '/^C/ { print length($1) }' file
|
||||
| Google The UNIX and Linux Forums |
| Thread Tools | |
| Display Modes | |
|
|