Sponsored Content
Full Discussion: parsing output
Top Forums Shell Programming and Scripting parsing output Post 302215116 by looza on Tuesday 15th of July 2008 02:58:04 PM
Old 07-15-2008
parsing output

I have a file that contains the output of the ls -iR command, something like this:



./results:
2504641011 result_1410 2500957642 result_525
2504641012 result_1425 2500957643 result_540

./tests/1:
2500788755 1 2500788743 1000

./tests/2:
2500788759 3 2500788758 999


I need to parse it so that I have the directory in one file and the fnames and inodes in another. How can I do this?

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

parsing output from ls command

I have to test the directory name which is obtained from for dir in `ls -l|grep $9 ' i need to check whether it is directory ( if yes, I have to check the first 3 character fo the directory how can I do that? Please help me thanks (3 Replies)
Discussion started by: ajaya
3 Replies

2. Shell Programming and Scripting

Parsing output

I need to parse the following out put and determine if the USB is a DISK and whether or not it's External. If an HBA line contains "USB" then does the next line contain "DISK" and "External". 0:0,31,0: HBA : (aacraid,1) AAC SCSI 0,0,0: DISK : Adaptec ASR4800SAS Volu0001 ... (6 Replies)
Discussion started by: lochraven
6 Replies

3. Shell Programming and Scripting

parsing output of system()

Hi, From the above output of df command I need to parse only 43G (available space) and display it. root@localhost:> df -h /vol1/joy Filesystem Size Used Avail Capacity Mounted on /vol1/joy 180G 137G 43G 76% ... (3 Replies)
Discussion started by: cjjoy
3 Replies

4. Shell Programming and Scripting

parsing ifconfig output

I'm trying to gather information on the interfaces on a large number of servers. If I run ifconfig I will get: eth0 Link encap:Ethernet HWaddr 00:50:56:A2:27:C1 inet addr:10.145.xxx.xxx Bcast:10.152.45.255 Mask:255.255.254.0 ----- eth1 Link... (2 Replies)
Discussion started by: C0ppert0p
2 Replies

5. Shell Programming and Scripting

Parsing the date output

Hi fellows, I need to define a notification for SSL certificate expiration. My Command output is below: (this is the "Expiration Date") Tue Mar 15 09:30:01 2012 So, at 15th Feb (1 month before the expiration), a notification has to be triggered by a script or sth else. How can i set an... (5 Replies)
Discussion started by: oduth
5 Replies

6. Shell Programming and Scripting

Parsing the output from top

Guys can you help me fix this parse error. Here's my script. #!/bin/bash # Set up limit below NOTIFY="6.0% us 6.1% us 6.2% us 6.3% us 6.5% us 6.6% us 6.7% us 6.8% us 6.9% us 7.0% us" # CPU Usage every minute TOP="$(top -b -n2 -d 00.20 |grep Cpu|tail -1 | awk -F ":" '{ print $2 }' | cut... (3 Replies)
Discussion started by: redtred
3 Replies

7. Shell Programming and Scripting

parsing output

Can somebody provide a solution to parse the following; cat /tmp/xxx Name: QUE_REQU (o.mtaseast-o.dmart) (MTPost queue) Number of messages: 66446 (Age 686 min; Size 214 mb) Backlog (messages): 0 (Age 0 min) Name: QUE_REQU... (6 Replies)
Discussion started by: BeefStu
6 Replies

8. Shell Programming and Scripting

Parsing Output of a Variable

i have a log file that contains something similar to this: one two three four five six seven eight nine ten eleven twelve thirteen fourteen one two three four five six seven eight nine ten eleven twelve thirteen fourteen one two three four five six seven eight nine ten eleven twelve... (3 Replies)
Discussion started by: SkySmart
3 Replies

9. Shell Programming and Scripting

Parsing of TOP output

Hi , i am trying to set up an alert, when CPU usage (0.2%us in below output) is more than 40% top | head | grep '^Cpu' Cpu(s): 0.2%us, 0.2%sy, 0.0%ni, 99.1%id, 0.6%wa, 0.0%hi, 0.0%si, 0.0%st using CUT, i pulled the value 0.2 and assigned to CPU (variable) CPU=$(expr `top | head -10... (5 Replies)
Discussion started by: Prateek007
5 Replies

10. Shell Programming and Scripting

Parsing nsupdate's output

Anybody that's ever used nsupdate knows that it's error management is not very good. I have a wrapper script that when it's got all the information it needs launches the nsupdate command. This is my attempt at parsing the output to help support users quickly know if the command succeded or... (7 Replies)
Discussion started by: maverick72
7 Replies
SHELLTEST(1)							   version 1.2.1						      SHELLTEST(1)

NAME
shelltestrunner - test command-line programs or arbitrary shell commands SYNOPSIS
shelltest [options] {testfiles|testdirs} DESCRIPTION
shelltestrunner tests command-line programs (or arbitrary shell commands). It reads simple declarative tests specifying a command, some input, and the expected output, and can run them run in parallel, selectively, with a timeout, in color, and/or with differences high- lighted. OPTIONS
-a, --all Show all failure output, even if large -c, --color Show colored output if your terminal supports it -d, --diff Show failures in diff format -p, --precise Show failure output precisely (good for whitespace) -x STR, --exclude=STR Exclude test files whose path contains STR --execdir Run tests from within the test file's directory. Test commands normally run within your current directory; --execdir makes them run within the directory where they are defined, instead. --extension=EXT Filename suffix of test files (default: .test) -w, --with=EXECUTABLE Replace the first word of (unindented) test commands. This option replaces the first word of all test commands with something else, which can be useful for testing alternate versions of a program. Commands which have been indented by one or more spaces will not be affected by this option. --debug Show debug info, for troubleshooting --debug-parse Show test file parsing info and stop --help-format Display test format help -?, --help Display help message -V, --version Print version information -- TFOPTIONS Set extra test-framework options like -j/--threads, -t/--select-tests, -o/--timeout, --hide-successes. Use -- --help for a list. Avoid spaces. DEFINING TESTS
Test files, typically named tests/*.test, contain one or more tests consisting of: o a one-line command o optional standard input (<<<), standard output (>>>) and/or standard error output (>>>2) specifications o an exit status (>>>=) specification Test format: # optional comment the command to test <<< zero or more lines of standard input >>> zero or more lines of expected standard output (or /REGEXP/ added to the previous line) >>>2 zero or more lines of expected standard error output (or /REGEXP/ added to the previous line) >>>= EXITCODE (or /REGEXP/) o A /REGEXP/ pattern may be used instead of explicit data. In this case a match anywhere in the output allows the test to pass. The regu- lar expression syntax is regex-tdfa (http://hackage.haskell.org/package/regex-tdfa)'s. o EXITCODE is a numeric exit status (http://en.wikipedia.org/wiki/Exit_status), eg 0 for a successful exit. o You can put ! before a /REGEXP/ or EXITCODE to negate the match. o Comment lines beginning with # may be used between tests. EXAMPLES
Here's example.test, a file containing two simple tests: # 1. let's test that echo runs. Numbering your tests can be helpful. echo >>>= 0 # 2. and now the cat command. On windows, this one should fail. cat <<< foo >>> foo >>>= 0 Run it with shelltest: $ shelltest example.test :t.test:1: [OK] :t.test:2: [OK] Test Cases Total Passed 2 2 Failed 0 0 Total 2 2 AUTHORS
Simon Michael. shelltestrunner March 18 2012 SHELLTEST(1)
All times are GMT -4. The time now is 05:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy