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

Different results from awk, sed, tr

Reply to Message Icon

Original Message
Name: james_falco
Date: February 22, 2007 at 12:14:28 Pacific
Subject: Different results from awk, sed, tr
OS: HP-UX B.11.11 U
CPU/Ram: 7.99gb
Model/Manufacturer: 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?


Report Offensive Message For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Different results from awk, sed, tr

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software