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

String file substitution (tr command) 1

Status
Not open for further replies.

Bigcat37

Technical User
Oct 24, 2005
13
FR
Hi

how to translate the string aaZ to aZ in my file.
I'm on AIX 5.3 and 5.2

my file is
aaZgteksklkfi.

how to obtain
aZgteksklkfi

Thanks you
Regards
Denis
 
What do you mean by Translation?

Do you mean replacing the aaZ with aZ?
 
I want to substitute the substring aaZ by aZ.
Regards
Denis
 
I'm a little confused too, do you mean the filename or the file contents?

sed -e 's/aaZ/aZ'

or

mv aaZgteksklkfi aZgteksklkfi

or

tr 'aaZ' 'aZ' < inputfile > outputfile

Mike

"When we ask for advice, we are usually looking for an accomplice."
 
Sorry Mike

i mean the file contents.

the command tr 'aaZ' 'aZ' < inputfile > outputfile
doesn't work !

the problem is that aZ is smaller than aaZ ...


Thanks
Regards
Denis
 
I think in here you have to create a loop that will look for the occurence of aaZ and replace it with aZ.

I honestly don't have time to do this now but i will try to do it later in my spare time :)

Regards,
Khalid
 
try

as mrn suggested

sed 's/aaZ/aZ/' f1 > f3

f1 is your source filename f3 is new file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top