The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Listing directories and sub directories jinxor UNIX for Advanced & Expert Users 3 03-11-2008 10:27 AM
Wierd results with awk amatheny Shell Programming and Scripting 2 11-01-2007 06:12 PM
moving directories to new directories on multiple servers mackdaddy07 Shell Programming and Scripting 0 04-06-2007 12:30 PM
TOP Results AIX 5.3 mcastill66 AIX 1 09-26-2005 01:54 PM
set -A RESULTS Ashishm Shell Programming and Scripting 2 04-08-2002 01:26 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-22-2007
james_falco james_falco is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 10
Different results from awk, sed, tr in different directories???

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?
  #2 (permalink)  
Old 02-22-2007
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,409
You have a file named "1" in the first directory and you are not quoting the arguments to tr, so "[0-9]" is expanded by the shell to "1".
  #3 (permalink)  
Old 02-23-2007
james_falco james_falco is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 10
that is genius! yup I have file named 1 in the first directory. Yes, that is our resolution, to put double quotes for "[0-9]" and to "[A-Z]" "[a-z]". Just a stupid question:
1. How does tr read the file named 1, but I know the tr only accepts strings and characters. I tried to create a file named 3, and it accepts the 1 and 3 files and went to syntax error. how does it happens?
(aondufd1)acking:/aon/dev/psoft/FSTST88/autosys/parm>echo ${MailFile} | awk -F. '{ print $1 "." }' | sed 's/.*\(...\)\..*/>
+ echo mfint003pr.in1*
+ awk -F. { print $1 "." }
+ sed s/.*\(...\)\..*/\1/
+ tr -d 2 3
+ tr [A-Z] [a-z]
tr: The combination of options and String parameters is not legal.
Usage: tr [ -c | -cds | -cs | -ds | -s ] [-A] String1 String2
tr [ -cd | -cs | -d | -s ] [-A] String1
Closed Thread

Bookmarks

Tags
autosys

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0