exclude blank line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting exclude blank line
# 1  
Old 11-15-2011
exclude blank line

hi,

how can i exclude blank line along with #, in the below command.
Code:
crontab -l|grep -v "^#" |wc -l

thx

Last edited by Franklin52; 11-15-2011 at 03:43 AM.. Reason: Please use code tags, thank you
# 2  
Old 11-15-2011
Try...
Code:
crontab -l | egrep -v "(^[ ]*$|^#)"

--ahamed
# 3  
Old 11-15-2011
THX. perfect.
# 4  
Old 11-15-2011
in nawk ..
Code:
$ crontab -l | nawk '!/^#/&&/./'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In a file, replace blank line by the last line not blank above

Dear All, In a CSV file, say that a given column has been extracted. In that column, information is missing (i.e. blank lines appear). I would like to replace the blank lines by the last valid line (not blank) previously read. For example, consider the extract below: 123 234 543 111... (7 Replies)
Discussion started by: bagvian
7 Replies

2. Shell Programming and Scripting

Combine multiline to one line till a blank line

Hello, I have a file as :- ABC DEF GHI JKL <BlankLine> MNO PQR STU VWX <BlankLine> YZA I need it as below:- ABCDEFGHIJKL; MNOPQRSTUVWX; (3 Replies)
Discussion started by: jassi10781
3 Replies

3. Shell Programming and Scripting

Exclude First Line when awk

Hi there, Where do I add the !NR==1 into the awk statement such that it ignores the first line . awk '/1.2 Install/ {P=0} /1.1 Apply/ {P=1} P {print FILENAME, $0} ' solarisappsummary.txt solarisdbsummary.txt solaris_websummary.txt (12 Replies)
Discussion started by: alvinoo
12 Replies

4. Shell Programming and Scripting

sed - How to insert line before the first blank line following a token

Hello. I have a config file (/etc/my_config_file) which may content : # # port for HTTP (descriptions, SOAP, media transfer) traffic port=8200 # network interfaces to serve, comma delimited network_interface=eth0 # set this to the directory you want scanned. # * if have multiple... (6 Replies)
Discussion started by: jcdole
6 Replies

5. Shell Programming and Scripting

String search and print next all lines in one line until blank line

Dear all I want to search special string in file and then print next all line in one line until blank lines come. Help me plz for same. My input file and desire op file is as under. i/p file: A1/EXT "BSCABD1_21233G1" 757 130823 1157 RADIO X-CEIVER ADMINISTRATION BTS EXTERNAL FAULT ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

6. Shell Programming and Scripting

Have to exclude the first and last line of the file : help me

hi , i am very new to perl . scriptting.. pllease can any one help me ...pleaseeeeeee i ll have a file which look likes 123 |something |567 456 |welcome |789 457 |inboxpost |790 . . 123 |something |567 i have to execute all the lines in the file except the first and the... (14 Replies)
Discussion started by: vishwakar
14 Replies

7. Shell Programming and Scripting

Fill the empty line by adding line before blank line

FIle A "A" 2 aa 34 3 ac 5 cd "B" 3 hu 67 4 fg 5 gy output shud be A"" 2 aa 34 "A" 3 ac 34 "A" 5 cd 34 "B" 3 hu 67 "B" 4 fg 67 "B" 5 gy 67 (6 Replies)
Discussion started by: cdfd123
6 Replies

8. Shell Programming and Scripting

Replace two blank line with a single blank line

Hi Guys, I have a file in which each set of records are separated by two blank line. I want to replace it with a single blank line. Can you guys help me out? Regards, Magesh (9 Replies)
Discussion started by: mac4rfree
9 Replies

9. Shell Programming and Scripting

sed: delete regex line and next line if blank

Hi, I want to write a sed script which from batiato: batiato/giubbe: pip_b.2.txt pip_b.3.txt pip_b.3mmm.txt bennato: bennato/peterpan: 123.txt consoli: pip_a.12.txt daniele: (2 Replies)
Discussion started by: one71
2 Replies

10. Shell Programming and Scripting

exclude a line

Hi, thanks for your help. I wrote this script : # ! /bin/sh file=snapshot.txt cat $file | while read line ; do { myvariable=`grep "Nombre de ROLLBACK internes" |sed 's/.*.=//'` echo $myvariable } done It looks in a file "snapshot.txt" for the lines containing "Nombre de ROLLBACK... (3 Replies)
Discussion started by: big123456
3 Replies
Login or Register to Ask a Question