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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cat: write error: Bad address 2

Status
Not open for further replies.

BIS

Technical User
Jun 1, 2001
1,893
NL
Anybody knows what this means?
 
Hi,
Are you trying to cat from the file and output to the file at the same time by any chance?
 
...well yes:

cat /path/to/file.txt | tr -d '\n' > /path/to/file.txt

I thought this was OK. Funny thing is it works sometimes...
 
man cat
a) you are overwriting the same file
cat FILE | do something >FILE
:(
b) please stop using stupid commands like
cat | grep | tr and so on
tr -d '\n' filname >Nfilename
:((((((((

-----------
when they don't ask you anymore, where they are come from, and they don't tell you anymore, where they go ... you'r getting older !
 
jamisar,

many thanks - I am just starting so bear with me....

A quick question, can I do more tr in the same line?

For example, tr -d '\n' and tr -d ' ' ?
 
in 'man tr' you will find

tr -d '[:space:]'
-----------
when they don't ask you anymore, where they are come from, and they don't tell you anymore, where they go ... you'r getting older !
 
hmm, why does this not work?

tr -d 'sum' file1 > file2

file1:
one,two,sum,three

I thought it would delete the 'sum' part leaving only

one,two,three in file2
 
Hi,
It works for me tr -d 'sum' < file1 > file2
the string sum is removed leaving a string of
one,two,,three in file2. (note the comma was not removed).
 
mrregan,

it was the < I had forgotten - many thanks...
 
Hmmm <grin> Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top