Sponsored Content
Top Forums Shell Programming and Scripting How to suppress error in following command? Post 302858867 by angshuman on Tuesday 1st of October 2013 02:06:35 PM
Old 10-01-2013
Hi RudiC,

I am not sure with previous file. However, please refer to this attached file.

When I run both the following commands, I get two diff output.

Code:
awk -F" " '/^040/ {REC++; SUM+=$15; FN=FILENAME} END {printf ("%s;%d;%0.2f\n", FN,REC,SUM/100)} ' myfile.txt

output : myfile.txt;2;0.00


Code:
grep ^040 myfile.txt | cut -f14

Output:

1000
1000

These files are tab delimited. If you notice, you will see that some of the fields have text separated by space. Hence If I use space as delimiter, the output will not be consistent. When I use cut command to get field 14, I get consistent result across all files.

For example in the following line

Code:
040     40      0       0123683106      00389486375     80      RCCCFN  11      1380302611      02      03      MOBILE 012      0       40      0       NL02

MOBILE 012 is one field. If you check the second file that I have uploaded, you can see that this particular field can have text containing multiple spaces.

Thanks
Angshuman

Last edited by angshuman; 10-01-2013 at 09:29 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to suppress error messages in script

I am getting the following upon cat a file which is not present in directory. "cat: cannot open test1.txt" I need to process files and I want that this message should be suppressed. thx (5 Replies)
Discussion started by: helper2007
5 Replies

2. Shell Programming and Scripting

Suppress error message in unzip

I'm creating a bsh shell to unzip a file from one directory into another. The directory that holds the zip files has zip files constantly being added to it, so I am testing it before it does the unzip and more. Right now my code looks like this: unzip -tq $ZIP_PATH/$ZIP_NAME >/dev/null if ... (5 Replies)
Discussion started by: skwyer
5 Replies

3. Shell Programming and Scripting

Suppress error message in shell script

Hi All this is a simple script #! /bin/bash FileCnt=`ls -lrt $DIR/* | wc -l` echo $FileCnt how could i escape the error msg if there are no files in $DIR ls: /home/sayantan/test/files/cnt/*: No such file or directory 0 Looking forward for a quick reply Regards, Newbie... (3 Replies)
Discussion started by: newbie07
3 Replies

4. Shell Programming and Scripting

how to suppress list number from history command output

i run history command and I want to eliminate the list number. So far this perl script works as long as the list is a exact 3 character long. cat dd | perl -pe 's,\d{3},,' 70 export JAVA_HOME=. 81 export JAVA_HOME=. 82 export JAVA_HOME=`pwd` export JAVA_HOME=`pwd` ... (1 Reply)
Discussion started by: soemac
1 Replies

5. Shell Programming and Scripting

how to suppress dd output?

I have to stop the output of dd from writing to terminal. Here is the command: sudo dd if=boot1h of="/dev/r$temp1" Here is the output: 2+0 records in 2+0 records out 1024 bytes transferred in 0.000804 secs (1273715 bytes/sec) I have tried >> log.txt but it doesn't work. Is there... (4 Replies)
Discussion started by: msf5042
4 Replies

6. HP-UX

glance adviser suppress newline in print command

Hi, I have a glance adviser, the highlights below. The problem that i have is that every time glance finds process name "abc" it write the memory region data in a new line. My question is if i have a way to print without newline? The output line for process abc looks something like this:... (0 Replies)
Discussion started by: yochaia01
0 Replies

7. Shell Programming and Scripting

How to suppress the error while copying the file

HI , I am tryin to copying multiple files from some dir. If the files are not present. It should not throw error in the screen. HOw to do that . Please help (4 Replies)
Discussion started by: arukuku
4 Replies

8. Shell Programming and Scripting

Suppress Error Message

How can I suppress a error message being given by awk command in bash shell? (2 Replies)
Discussion started by: Prachi Gupta
2 Replies

9. Shell Programming and Scripting

Tcsh: How to suppress error messages.

Hallo, I wrote some script: 95% of the script's output consists of error messages like "mkdir: cannot create directory ‘final': File exists Exit 1" and "rm: No match. Exit 1". These messages are not harmful at all, but they make the output almost unreadable. How can I get rid of... (5 Replies)
Discussion started by: DanielDD
5 Replies
IRSEND(1)								FSF								 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.8.7pre1 May 2010 IRSEND(1)
All times are GMT -4. The time now is 12:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy