Computing.Net > Forums > Unix > Different results from awk, sed, tr

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Different results from awk, sed, tr

Reply to Message Icon

Name: james_falco
Date: February 22, 2007 at 12:14:28 Pacific
OS: HP-UX B.11.11 U
CPU/Ram: 7.99gb
Product: HP-UX 9000/800
Comment:

I cannot explain why it gives different results when I try the awk, sed, tr command combination with the same input.
(aondufd1)psoftfs:/aon/dev/psoft/FSTST88/autosys>echo ${MailFile}
+ echo mfint003pr.in1*
mfint003pr.in1*
(aondufd1)psoftfs:/aon/dev/psoft/FSTST88/autosys/scripts>echo ${MailFile} | awk -F. '{ print $1 "." }' | sed 's/.*\(...\)\..*/\1/' | tr [A-Z] [a-z] | tr -d [0-9]
+ echo mfint003pr.in1*
+ awk -F. { print $1 "." }
+ sed s/.*\(...\)\..*/\1/
+ tr -d 1
+ tr [A-Z] a
3pr
(aondufd1)psoftfs:/aon/dev/psoft/FSTST88/autosys/scripts>cd ../parm
+ cd ../parm
(aondufd1)psoftfs:/aon/dev/psoft/FSTST88/autosys/parm>echo ${MailFile} | awk -F. '{ print $1 "." }' | sed 's/.*\(...\)\..*/\1/' | tr [A-Z] [a-z] | tr -d [0-9]
+ echo mfint003pr.in1*
+ awk -F. { print $1 "." }
+ sed s/.*\(...\)\..*/\1/
+ tr -d [0-9]
+ tr [A-Z] [a-z]
pr
One big question mark in my head right now. Could someone please help. Thanks.
There were no additional profiles loaded when changing directories. just doing the cd command.
The output should be 3pr. That would be the correct one, right?



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Different results from awk, sed, tr

Awk/Sed Question www.computing.net/answers/unix/awksed-question/7889.html

Export variables from awk www.computing.net/answers/unix/export-variables-from-awk/7261.html

awk/sed help www.computing.net/answers/unix/awksed-help/6553.html