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!

how to del tab

Status
Not open for further replies.

koeicjm

Programmer
Sep 12, 2001
73
JP
I want delete tab from the line head the org line is
<logs>/var/log/chat/sony</logs>
->when i cat it, it said,
#cat AirseServer.xml | grep &quot;<logs>&quot;
<logs>/var/log/chat/sony</logs>

->but I can not delete the tab , what is wrong
freebsd# cat AirseServer.xml | grep &quot;<logs>&quot; | sed -e 's\^t*<logs>\(.*\)<\/logs>!\1!'
sed: 1: &quot;s\^t*<logs>\(.*\)<\/log ...&quot;: substitute pattern can not be delimited by newline or backslash






fbsd# cat AirseServer.xml | grep &quot;<logs>&quot; | sed -e 's\^\t*<logs>\(.*\)<\/logs>!\1!'


sed: 1: &quot;s\^t*<logs>\(.*\)<\/log ...&quot;: substitute pattern can not be delimited by newline or backslash
 

Hi,
Can you run the file through

expand

This will by default expand all tabs to a tabstop of 8 spaces. if you want smaller tabs stops you can specify that as well.

then you can just do something like

s/ */ /g

which will substitute every group of 2 or more spaces to a single space.

unfortunately this doesn't know about quotes or strings and therefore may remove spaces in Strings altering the contents of tags.

----
 
to delete all tabs :-
sed 's/'`echo &quot;\015&quot;`'//g' file > filenew

HTH ;-) Dickie Bird
db@dickiebird.freeserve.co.uk
 
it seems echo &quot;\015&quot; donot work
 
The only way I could get this to work myself was :
sed 's/ //g' dumfile > newfile
where this gap after &quot;s/&quot; is created by holding down Cntrl V and pressing capital I ( which creates a tab )
HTH ;-) Dickie Bird
db@dickiebird.freeserve.co.uk
 
Are you sure you're using backticks here:

sed 's/'`echo &quot;\015&quot;`'//g' file > filenew

Backticks can usually be found above the tab key, below Esc.

HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top