Grep into columns


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Grep into columns
# 1  
Old 09-30-2013
Grep into columns

Hi folks,
hopefully an easy one .... I've got a hefty patching project going on on Solaris 8 boxes.....

I'm trying to make a spreadsheet with the current packages, revision , description, patches etc

I'd like to put the information output from pkginfo into columns... so eg :-
system SUNWab2r Answerbook2 Doc Server

are all in separate columns. Even if I can grep each column into a separate file which is then copied into the spreadsheet...

Like I said, I'm sure it's a real easy one Smilie

Cheers in advance
Martin
# 2  
Old 09-30-2013
What output do you get from your pkginfo command? If we can see that, then I'm sure we can help.

What do you need the output to look like? Remember that spreadsheet applications will read lots of data formats, so they could be fixed width or delimited (comma, space, pipe, @ or other separator)

What have you tried to do so far to get from the pkginfo format into what you need?



Robin
# 3  
Old 09-30-2013
http://endlessnow.com/ten/Source/sun-info-sh.txt

If you look down in that file, there's a function called hw_sunos_software() ...
Take a look at what it does with regards to pkginfo using nawk... modify it to format however you want.
# 4  
Old 10-01-2013
Many thanks...
It's just basic info really...
pkginfo -l SUNWjmfp gives too much info .... but from it I'd like
PKGINST:
NAME:
CATEGORY:
STATUS:

it'd be good to know which patches apply to which pkg's
patchadd -p seems to tie these two together but with 715 patches applied it's a slow process to do this manually....
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep in specific columns

I am trying to search a list of strings from a file and display the string as well as the column in the search file it was found. I dont care about the row. what is wrong with my script? while read line; do awk -v var="$line" '{for(i=1;i<NF;i++) if ($NF==$var) break; print $var FS $NF' }'... (3 Replies)
Discussion started by: senhia83
3 Replies

2. Shell Programming and Scripting

Grep in multiple columns

Hi All, One of my source file is having more than 100 columns. Now, I need to check the particular string in 75th,76th and 79th columns of the source file. If I find the particular string in above mentioned columns, then I need to print the entire record with line number. Kindly help... (2 Replies)
Discussion started by: suresh_target
2 Replies

3. Shell Programming and Scripting

Grep and print only certain columns from a row

Hi Friends, This is my input chr1 100 200 + gene_name "alpha"; protein_name "alpha"; level 2; tag "basic"; info "known"; chr1 245 290 + gene_name "alpha-1"; protein_name "alpha-2"; level 9; tag "basic"; info "uknown"; chr1 310 320 + gene_name "alpha"; protein_name "alpha-4"; level 2; info... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

4. Shell Programming and Scripting

Grep and convert into columns

I have 1000 different autosys jobs, want to extract only this information using unix commands. Tried with normail greping but unable to make columns into rows. Input: /* ----------------- template ----------------- */ insert_job: template job_type: c box_name: box1 command:... (3 Replies)
Discussion started by: onesuri
3 Replies

5. Shell Programming and Scripting

grep on columns

Hi, my data is this way abc def 01000000 kil ghi 23 01000000 kim ghj 0000 01000000 omg now, I would like to replace 01000000 on the third column as 0. I have a file with that value in different columns. So, any awk one liner that can let me change the column $ value would be highly... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

6. UNIX for Dummies Questions & Answers

grep only from a range of columns

Hello all, I have a .csv file with over 100 columns. I would like to grep for a pattern only searching within a range of those fields, and print the entire line. For example: grep a pattern from columns $47-$87, but print fields $0 - $100 Thanks! (9 Replies)
Discussion started by: torchij
9 Replies

7. Shell Programming and Scripting

Grep based on specific columns.

Hi, How can I grep a record for a value based on specific column. If I simply do a grep 'AB' FilenName.txt, I might end up getting the records returned whose part of value is 'AB'. But I want it specific to second column. cut -d'|' -f 2 FileName.txt | grep 'AB' But now it will return... (1 Reply)
Discussion started by: deepakwins
1 Replies

8. Shell Programming and Scripting

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 ... (2 Replies)
Discussion started by: za_7565
2 Replies

9. UNIX for Advanced & Expert Users

Grep all the columns based on a particular column

This is the data file that I have 21879, 0, 22, 58, 388 0, -1, 300, 1219172589765, 1708, 0, 200, 21891, 0, 0, 33, 309 0, -1, 300, 1219172591478, 1768, 0, 200, 22505, 0, 0, 33, 339 0, -1, 300, 1219172593251, 1738, 0, 200, 21888, 0, 1, 33, 308 0, -1, 300, 1219172594995, 633, 0, 200, 24878,... (2 Replies)
Discussion started by: pmallur
2 Replies

10. UNIX for Dummies Questions & Answers

using Grep for only a certain number of columns

I am given a file with a list of names for the first 20 characters. The 20 characters after is a list of names that somebody is supposed to team up with. Now i'm trying to write a simple script that will read a name somebody inputs and then looks only in the first 20 characters. For example.... (2 Replies)
Discussion started by: MaestroRage
2 Replies
Login or Register to Ask a Question