Unix grep questions
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Unix grep questions

  1. #1
    Join Date
    Mar 2001
    Posts
    286

    Unix grep questions

    I am writting a Unix script for my db admin. How do you remove empty lines?

    For example, a file like this:
    "abc fdafdsa

    xyz
    abcsyz"

    I want to output the file to be:
    "abc fdafdsa
    xyz
    abcsyz"

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    as i recall is would be ...

    grep -v '^$'
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    May 2001
    Location
    San Francisco, California
    Posts
    510
    grep -v "^$" filename > newfilename

    Newfilename is the new file without blank lines.
    Remember the Golden Rule - He who has the gold makes the rules!
    ===================
    Kris109
    Ph.D., OCP 8i, 9i, 10g, 11g DBA

  4. #4
    Join Date
    Mar 2001
    Posts
    286

    Thank you.

    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width