The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
TimeStamp clarification Sreejith_VK Shell Programming and Scripting 2 04-09-2008 12:07 AM
Sun Unix command clarification FredSmith SUN Solaris 4 07-12-2007 01:30 AM
Need clarification ravi.sadani19 Shell Programming and Scripting 2 04-13-2007 01:55 AM
nawk command clarification Tux_Raju Shell Programming and Scripting 2 07-28-2005 09:28 AM
"find" command clarification ck-18 UNIX for Dummies Questions & Answers 3 05-21-2002 02:46 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-18-2008
vparunkumar vparunkumar is offline
Registered User
  
 

Join Date: Dec 2007
Location: Chennai , India
Posts: 17
Unhappy need clarification about tr -d command ?

Hi ,
I need your help to know the exact operation of this following code ..

cat file1 | ux2dos | tr -d ''>>file2

file1 contains only one line : "DTS-PO\SPECTRUM WO 56"
the data contains a META CHAR "\" .. look at the above line.
But , The file2 output contains : "DTS-POSPECTRUM WO 56^M"
The "\" does not appear in the file2.
The ux2dos appends ^M in the end of line.

My questions are :

1. what is the operation performed by tr -d '' ?
what is the usage of this arrow mark option ?
2. is the arrow option ignore the ALL Special meta char's? or the ux2dos ignore or delete the special META Char's?
3. is there any way to allow the meta char's would be appeared in the file2?

Note : Environment = IBM AIX 5.3
Shell = ksh
  #2 (permalink)  
Old 03-18-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,861
tr -d " does not make any sense.

Are you sure it was not tr -d "\""?
  #3 (permalink)  
Old 03-18-2008
era
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
fpmurphy: his example has a literal control character which my browser displays as an empty box.

This smells of homework from the intro course. @vparunkumar: Read the book your lecturer gave you, it has the answers and that's why he gave it to you.

Send him o her our regards, you can say we awarded a "Useless Use of Cat Award" for this example.
  #4 (permalink)  
Old 03-18-2008
nua7 nua7 is offline
Registered User
  
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 353
Wink

Agreed with era..

But to get you going , following is the one of the most common usgaes of tr -d..

Code:
ls -l /home/nua7 | tr -d " " | cut -d " " -f2
This would list all files in the given path, equally space out the fields with a space " ", which is further used as a demiliter in cut command.

Hope this helps..!

Last edited by Yogesh Sawant; 03-18-2008 at 08:30 AM.. Reason: added code tags
  #5 (permalink)  
Old 03-18-2008
vparunkumar vparunkumar is offline
Registered User
  
 

Join Date: Dec 2007
Location: Chennai , India
Posts: 17
Red face To fpmuphy and era

In my previous post , some char was missing in tr command !!!

the actual script line looks like

cat file1 | ux2dos | tr -d '->' >>file2

i could not able to copy/paste the exact symbol.. this editor doesnt accept ... , but it is a perfect arrow symbol(->)

To era : :-)
This is not LAB exercise .....real time issue ...
I am working in IBM India..and i am new to AIX/UNIX . This is a bug , which i found .. But i could not understand the meaning of arrow symbol ..
could you help me ?
  #6 (permalink)  
Old 03-18-2008
era
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
tr -d removes any occurrence of the indicated character(s) from the input, and copies the rest. A very quick glance at the tr(1) manual page would have told you this.

Conventionally ux2dos replaces line feeds with carriage return+line feed but it's not a standard command, it could do other stuff like change slashes in file names to backslashes or what not if it's a specialized command. (Often unix2dos is a simple wrapper around a one-line tr or sed script, too.)

If you don't want to remove the mystery arrow character, take out the "tr". I assume it was put there for a reason, though.

Sorry for the sarcasm, and hope this helps.
  #7 (permalink)  
Old 03-18-2008
vparunkumar vparunkumar is offline
Registered User
  
 

Join Date: Dec 2007
Location: Chennai , India
Posts: 17
To era

I am a fresh engineering graduate , recently joined in IBM .. and new to this AIX/unix
Thanks for your valuable reply ..

Now i understood the tr -d command ..

is the problem due to ux2dos conversion ?
will ux2dos change/modify the input string which contains meta char ?

please give me some links , to read about ux2dos ?
Sponsored Links
Closed Thread

Bookmarks

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 01:14 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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