[Ilugc] Removing Blank lines and same file has to be affected

  • From: girish1729@xxxxxxxxx (Girish Venkatachalam)
  • Date: Wed Aug 16 16:01:34 2006


- Ashok Antony <anjeas_net@xxxxxxxxx> wrote:

Hi all

sed '/^$/d' file1.txt

removes the blank lines and file1.txt has to be
affected by this command.

I mean the file1.txt should contain non-empty lines.

Good question. I thought it was not possible but got
to know that this can give u what u want.

$ perl -pi -e 's/^\s$//' file1.txt

Unforunately I am forced to say that perl is
counterintuitive when it comes to certain things...

Even in regexes where it should have been backward
compatible with flex and sed regexes, sometimes things
just don't work as you expect. 

I mean why say /^\s$/ when it is enuf to say /^$/? 

Anyway hope you got what you wanted...

regards,
Girish
anthony

              
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls
to the US (and 30+ countries) for 2???/min or less.
_______________________________________________
To unsubscribe, email ilugc-request@xxxxxxxxxxxxx
with 
"unsubscribe <password> <address>"
in the subject or body of the message.  
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com ;

Other related posts: