Sponsored Content
Top Forums Shell Programming and Scripting tr command giving wrong output Post 302313979 by usha rao on Thursday 7th of May 2009 06:49:25 AM
Old 05-07-2009
tr command giving wrong output

Hi All,
i have a file which have many fields delimited by ,(comma)
now i have to show only few fields and not all.

the sample text file looks like this:

Code:
 
TYPE=SERVICEEVENT, TIMESTAMP=05/06/2009 11:01:40 PM, HOST=sppwa634, APPLICATION=ASComp, FUNCTION=LimitsService, SOU
RCE=com.example.as.limits.ejb.LimitsServiceBean, SOURCE_METHOD=getLimitsList, MESSAGE=Failed to execute the
 CAS Limits Transaction via tfwk2.0 - due to SORResponseException: com.example.util.transfwk.exception.SORR
esponseException : Timed out in receive for CorrelationID:ID:414d512053505057413633342020202049fb54cf2a1a5dd0 from:
CASA:JMSWrapper : receive() :Timed out waiting for response for a correlation id : [ID:414d512053505057413633342020
202049fb54cf2a1a5dd0]QCFPoolName : [CASQCF] and ResponseQueueName : [MYCA_CAS_REPLY_QUEUE] Timeout[10000]for Card N
umber : , SESSION_ID=b302cbd0-8d67a6e6-e3f371bd-d2561b0d, GUID=null, CARD_TYPE=null, ENTRY_URL=account, STATUS=fals
e, TIME_TO_EXECUTE=36079, MARKET_IDENTIFIER=null, FAILED_SYSTEM=null, FAILURE_CATEGORY=null, FAIL_REASON_TEXT=null



Form this file if i want to remove fields APPLICATION and SOURCE_METHOD both ending with a ,

i am using this line

cat myfile | tr -d 'APPLICATION' 'SOURCE_METHOD'


But this command is not working properly

It is giving output like this:

Code:
 
YE=SERVEEVE, MESM=05/06/2009 11:01:40 M, HS=sppwa634, =Somp, FU=imitsService, SURE=com.example.as.limits.ej
b.imitsServiceBean, SURE_MEHD=getimitsist, MESSGE=Failed to execute the S imits ransaction via tfwk2.0 - due to SRR
esponseException: com.example.util.transfwk.exception.SRResponseException : imed out in receive for orrelat
ionD:D:414d512053505057413633342020202049fb54cf2a1a5dd0 from:S:JMSWrapper : receive() :imed out waiting for respons
e for a correlation id : [D:414d512053505057413633342020202049fb54cf2a1a5dd0]QFoolame : [SQF] and ResponseQueueame
: [MY_S_REY_QUEUE] imeout[10000]for ard umber : , SESS_D=b302cbd0-8d67a6e6-e3f371bd-d2561b0d, GUD=null, RD_YE=null,
 ERY_UR=account, SUS=false, ME__EXEUE=36079, MRKE_DEFER=null, FED_SYSEM=null, FURE_EGRY=null, F_RES_EX=null


It is not removing the complete fields but removing some letters from every field.

Please advice.
Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script giving wrong results....

hi, I have this script which gives me the result... #! /usr/bin/sh set -x cd /home/managar a=1 while true do if then echo " File log.txt exists in this directory " exit 0 fi echo " File has not arrived yes..." sleep 3 let a=a+1 if then (1 Reply)
Discussion started by: mgirinath
1 Replies

2. AIX

Shared memory giving wrong value

Hi , I am working on AIX 5.3 server.I have small program which stores the from database to a particaular shared memory.But while retreiving the valus from the same shared memory, i am getting wrong values. Please help..... (1 Reply)
Discussion started by: ajaysahoo
1 Replies

3. UNIX for Dummies Questions & Answers

AWK command giving wrong input

Hi all, I have a problem with qwk command. i have to check process status and for that i am using command prstat -mvL 1 1 and it gives me the entire output but when i use this command with awk like this: prstat -mvL 1 1 | awk -F" " '{print $1,$15}' to get first and 15th arguments. ... (3 Replies)
Discussion started by: usha rao
3 Replies

4. Shell Programming and Scripting

Sort command giving wrong output

Hi all, I have a problem with sort command. i have a file which looks like this: "file1 1073 java/4 1073 java/180 1073 java/170 1073 java/176 1073 java/167 1073 java/40 1073 java/33 1073 java/136 28988 java/76 28988 java/73 28988 java/48 28988 java/26" and i want to sort... (8 Replies)
Discussion started by: usha rao
8 Replies

5. Emergency UNIX and Linux Support

getting wrong output with AWK command!!!

i have a file which gets appended with 9 records daily and the file keeps growing from then...i use to store the previous day files count in a variable called oldfilecount and current files count as newfilecount.my requirement is that i need to start processing only the new records from the... (3 Replies)
Discussion started by: ganesh_248
3 Replies

6. UNIX for Advanced & Expert Users

xbindkeys giving wrong mapping information

Hello, I'm having a problem with xbindkeys giving the wrong mapping information, hence I can't get it work at all when trying new mappings from this machine. From another computer, I have some definitions for xbindkeys (made with xbindkeys-config). These key codes work correctly on this... (0 Replies)
Discussion started by: Narnie
0 Replies

7. Shell Programming and Scripting

Wrong output in find command

Hi guys - I am trying a small script to tell me if there is a file that exists less than 1k. It should report ERROR, otherwise the check is good. I wrote this script down, however it never runs in the if/then statement. It always returns the echo ERROR. MYSIZE=$(find /home/student/dir1... (8 Replies)
Discussion started by: DallasT
8 Replies

8. Shell Programming and Scripting

Grep command showing wrong output in Linux

Hi All I am trying to run a script in linux wherein i have a command like this grep ^prmAttunityUser= djpHewr2XFMAttunitySetup_ae1_tmp djpHewr2XFMAttunitySetup_ae1_tmp is a temporary file in which the user value is stored but this command in the script returns me balnk value whereas it has a... (4 Replies)
Discussion started by: vee_789
4 Replies

9. Shell Programming and Scripting

Number comparison in ksh on mac with -lt is giving wrong answer

I am trying to run following script in ksh on darwin 11.4.2: freeSpace=2469606195 spaceNeeded=200 ] && echo "no space" || echo "space available" ] && echo "no space" || echo "space available" "-lt" is giving wrong answer as "no space" Whereas '<' works fine. When I change the freespace... (4 Replies)
Discussion started by: sabitha
4 Replies

10. Shell Programming and Scripting

If && command giving wrong output

Hi All, I am trying to run a script which will search for 2 strings(stopped,started) in a text file and echo an output depending on below condition -bash-3.2$ cat trial1.txt v ggg f -bash-3.2$ cat trial1.sh VAR9=` grep 'stopped' /tmp/trial1.txt` VAR10=` grep 'started'... (4 Replies)
Discussion started by: srkmish
4 Replies
fmt(1)							      General Commands Manual							    fmt(1)

NAME
fmt - format text SYNOPSIS
width] [file...] DESCRIPTION
The command is a simple text formatter that fills and joins lines to produce output lines of (up to) the number of characters specified in the width option. The default width is 72. concatenates the arguments. If none are given, formats text from the standard input. Blank lines are preserved in the output, as is the spacing between words. does not fill lines beginning with a period for compatibility with Nor does it fill lines starting with Indentation is preserved in the output and input lines with differing indentation are not joined (unless is used). can also be used as an in-line text filter for the command: reformats the text between the cursor location and the end of the paragraph. Options recognizes the following options: Crown margin mode. Preserve the indentation of the first two lines within a paragraph and align the left margin of each subsequent line with that of the second line. This is useful for tagged paragraphs. Split lines only. Do not join short lines to form longer ones. This prevents sample lines of code, and other such "formatted" text, from being unduly combined. Fill output lines to up to width columns. WARNINGS
The width option is acceptable for BSD compatibility, but it may go away in future releases. SEE ALSO
nroff(1), vi(1). fmt(1)
All times are GMT -4. The time now is 11:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy