Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SED Delete Lines that contain only tabs 2

Status
Not open for further replies.

dodge20

MIS
Jan 15, 2003
1,048
US
Is it possible to delete lines that contain only tabs? Many times a tab delimited file has extra lines at the bottom of the file that contain only tabs, so they aren't null. How do I delete these lines?

Dodge20
 
Something like this ?
Code:
t=`echo "\t\c"`
sed '/^'"$t"'*/d' /path/to/input > output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That didn't seem to delete anything.

Dodge20
 
And this ?
sed '/^TabCharHere*$/d' /path/to/input > output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Wait I missed the *. That looks like it worked!

Thank You!

Dodge20
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top