Sponsored Content
Top Forums Shell Programming and Scripting grep required data from two columns Post 302287684 by za_7565 on Sunday 15th of February 2009 02:17:01 AM
Old 02-15-2009
grep required data from two columns

hello,

I have output from a command and I need to filter some info out of that. I tried awk command but I can not grep what I am looking for:

Following is the output and I need to capture "disabled" for each volume from first column and report:

# vol status
Volume State Status Options
vol8 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on,
read-only guarantee=volume(disabled)
vol9 online raid_dp, flex nosnap=on, snapmirrored=on,
snapmirrored create_ucode=on,
read-only convert_ucode=on,
fs_size_fixed=on,
guarantee=volume(disabled)
vol4 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on,
read-only guarantee=volume(disabled)
vol5 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on,
read-only guarantee=volume(disabled)
vol6 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on,
read-only guarantee=volume(disabled)
vol7 online raid_dp, flex nosnap=on, snapmirrored=on,
snapmirrored create_ucode=on,
read-only convert_ucode=on,
fs_size_fixed=on,
guarantee=volume(disabled)
vol0 online raid_dp, flex root
vol1 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on,
read-only guarantee=volume(disabled)
vol2 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on,
read-only guarantee=volume(disabled)
vol10 online raid_dp, flex nosnap=on, snapmirrored=on,
snapmirrored create_ucode=on,
read-only convert_ucode=on,
fs_size_fixed=on,
guarantee=volume(disabled)
vol3 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on, guarantee=none,
read-only

vol11 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on,
read-only guarantee=volume(disabled)
logvol online raid_dp, flex nosnap=on, snapmirrored=on,
snapmirrored create_ucode=on,
read-only convert_ucode=on,
fs_size_fixed=on,
guarantee=volume(disabled)
vol12 online raid_dp, flex snapmirrored=on,
snapmirrored fs_size_fixed=on,
read-only guarantee=volume(disabled)


So I need to see the following as output:

vol8 guarantee=volume(disabled)
vol9 guarantee=volume(disabled)
vol4 guarantee=volume(disabled)

and so on ........

really appreciate your help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help required in grep command

Hi all, I need some help in grep command in a ksh script. Actually, i need to list all files having the file name like "BORD*.DAT" but exclude the files (from the list) having name like "BORD*mgt*.DAT". For that i used the following command: ls | grep "BORD*.DAT" | grep -v "BORD*mgt*.DAT" ... (4 Replies)
Discussion started by: panzer
4 Replies

2. Shell Programming and Scripting

shell script required to convert rows to columns

Hi Friends, I have a log file as below siteid = HYD spc = 100 rset = RS_D_M siteid = DEL spc = 200 rset = RS_K_L siteid = DEL2 spc = 210 rset = RS_D_M Now I need a output like column wise as below. siteid SPC rset HYD 100 RS_D_M (2 Replies)
Discussion started by: suresh3566
2 Replies

3. UNIX for Advanced & Expert Users

sort out the required data

Hi All, I have a file 1.txt which has the duplicate dns entries as shown: Name: 000f9fbc6738.net.in|Addresses: 10.241.66.169, 10.84.2.222,212.241.66.170 Name: 001371e8ed3e.net.in|Addresses: 10.241.65.153, 10.84.1.101 Name: 00e06f5bd42a.net.in|Addresses: 10.72.19.218,... (6 Replies)
Discussion started by: imas
6 Replies

4. UNIX for Dummies Questions & Answers

Suggestion to convert data in rows to data in columns

Hello everyone! I have a huge dataset looking like this: nameX nameX 0 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ............... nameY nameY 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ..... nameB nameB 0 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ..... (can be several thousands of codes) and I need... (8 Replies)
Discussion started by: kush
8 Replies

5. Shell Programming and Scripting

Checking required columns in the file

Hi, File contains with TAB delimeter file,i want check the 2,3 are not null test1@gmail.com 100 test test2@gmail.com 101 test test3@gmail.com test test4@gmail.com 102 OUTPUT test1@gmail.com 100 test test2@gmail.com 101 test Please help me with one single command in... (2 Replies)
Discussion started by: muralikri
2 Replies

6. Shell Programming and Scripting

Checking the required columns in File

Hello Experts, File contains 10 columns with | delimeter. 1,3,4,5,7,9 columns are required columns means it should contains values. i need those records, rest of it will contain or not contain data. test1.txt: a@a.com|a|b|c|d|e|f|g|h|i |a|b|c|d|e|f|g|h|i b@b.com|a||c|d|e|f|g|h|i... (7 Replies)
Discussion started by: muralikri
7 Replies

7. Shell Programming and Scripting

Required help to print diff columns for 2 patterns using awk

Hi All, I need help for below scenario : I have a principals.xml_24092012backup file : cat principals.xml_24092012backup </user> <user username="eramire" password="2D393C01720749256303D204826A374D9AE9ABABBF8A"> <roleMapping rolename="VIEW_EVERYTHING"/> </user> ... (2 Replies)
Discussion started by: kiran_j
2 Replies

8. Shell Programming and Scripting

Help Need to fetch the required data

Hi Guys, Am in need of your help one more time on my real data. I have a file which contains more than thousand lines of data Live data shown for 4 iterations. We have more than thousand lines of data:- -------------------------------------------------------------------------- ... (4 Replies)
Discussion started by: rocky2013
4 Replies

9. UNIX for Beginners Questions & Answers

UNIX shell script required to read two columns from xml

Hello All, I am new to unix scripting. I need to read FROMINSTANCE, FROMFIELD from below XML code and need to write a script for insert into SQ_EPIC values( "DID", "PROJECT_NAME") Select DID, PROJECT_NAME from EPIC<CONNECTOR TOINSTANCETYPE="Source Qualifier" TOINSTANCE="SQ_EPIC" TOFIELD="DID"... (7 Replies)
Discussion started by: sekhar.lsb
7 Replies

10. UNIX for Beginners Questions & Answers

How to print multiple required columns dynamically in a file using the header name?

Hi All, i am trying to print required multiple columns dynamically from a fie. But i am able to print only one column at a time. i am new to shell script, please help me on this issue. i am using below script awk -v COLT=$1 ' NR==1 { for (i=1; i<=NF; i++) { ... (2 Replies)
Discussion started by: balu1234
2 Replies
ZGREP(1)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 07:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy