Sponsored Content
Top Forums Shell Programming and Scripting awk to print lines based on string match on another line and condition Post 302428804 by rowie718 on Friday 11th of June 2010 03:15:23 AM
Old 06-11-2010
hi rdcwayx,

thanks a lot for the reply. three things:

one is that when i run that code, i only get an output of exactly the code you wrote:
Code:
Rowie718:~/Desktop rowie$ ./parse_app_report2.sh 
awk '{printf (/:$/)?$0:$0"\n"}' ~/Desktop/parse_app_report2.sh |awk 'BEGIN{RS="";FS="\n"} /Adobe/ {split($2,a," ");print $1,a[2]}' 
Rowie718:~/Desktop rowie$

the 2nd thing is that i need to include Microsoft software as well as Adobe.

the 3rd thing thing is I believe i need the output to be comma or tab delimited in order to import to excel. on top of all this, if i can throw another twist in.... the source report has multiple people in it. each persons entry starts with a line that looks like this: Rowie-G5 (192.168.0.153) --the consistent part being "192.168.0.". Ideally Id need this script to output in a way such that I can import it into an excel sheet which will look like this (the pipe just signifies field separation):
Code:
Rowie-G5 | Bridge CS3 | 2.1.1.9 | Adobe Bridge CS4 | 3.0.0.464 | Microsoft Word | 12.2.4 |
User2 | Bridge CS3 | 2.1.1.9 | Adobe Bridge CS4 | 3.0.0.464 | Microsoft Word | 12.2.4 |
User3 | Bridge CS3 | 2.1.1.9 | Adobe Bridge CS4 | 3.0.0.464 | Microsoft Word | 12.2.4 |

Thanks so much for your help

Last edited by Franklin52; 06-11-2010 at 06:26 AM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

searching and storing unknown number of lines based on the string with a condition

Dear friends, Please help me to resolve the problem below, I have a file with following content: date of file creation : 12 feb 2007 ==================== = name : suresh = city :mumbai #this is a blank line = date : 1st Nov 2005 ==================== few lines of some text this... (7 Replies)
Discussion started by: swamymns
7 Replies

2. Shell Programming and Scripting

awk find a string, print the line 2 lines below it

I am parsing a nagios config, searching for a string, and then printing the line 2 lines later (the "members" string). Here's the data: define hostgroup{ hostgroup_name chat-dev alias chat-dev members thisisahostname } define hostgroup{ ... (1 Reply)
Discussion started by: mglenney
1 Replies

3. Shell Programming and Scripting

Based on column in file1, find match in file2 and print matching lines

file1: file2: I need to find matches for any lines in file1 that appear in file2. Desired output is '>' plus the file1 term, followed by the line after the match in file2 (so the title is a little misleading): This is honestly beyond what I can do without spending the whole night on it, so I'm... (2 Replies)
Discussion started by: pathunkathunk
2 Replies

4. Shell Programming and Scripting

awk print pattern match line and following lines

Data: Pattern Data Data Data Data Data Data Data Data Data ... With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Discussion started by: dmesserly
9 Replies

5. Shell Programming and Scripting

Print certain lines based on condition

Hi All, I have following listing Filesystem GB blocks Free Used Iused Iused Mounted on /dev/hd2 4.00 0.31 93 63080 43 /usr Filesystem GB blocks Free Used Iused Iused Mounted on Filesystem GB blocks Free Used Iused Iused... (11 Replies)
Discussion started by: ckwan
11 Replies

6. Shell Programming and Scripting

Print lines based on line number and specified condition

Hi, I have a file like below. 1,2,3,4,5,6,7,8,9I would like to print or copied to a file based of line count in perl If I gave a condition 1 to 3 then it should iterate over above file and print 1 to 3 and then again 1 to 3 etc. output should be 1,2,3 4,5,6 7,8,9 (10 Replies)
Discussion started by: Anjan1
10 Replies

7. Shell Programming and Scripting

Need to print the next word from the same line based on grep string condtion match.

I need to fetch particular string from log file based on grep condition match. Actual requirement is need to print the next word from the same line based on grep string condtion match. File :Java.lanag.xyz......File copied completed : abc.txt Ouput :abc.txt I have used below... (5 Replies)
Discussion started by: siva83
5 Replies

8. UNIX for Dummies Questions & Answers

awk - (URGENT!) Print lines sort and move lines if match found

URGENT HELP IS NEEDED!! I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. - Also the matching lines are not moving out of File1.txt ... (1 Reply)
Discussion started by: High-T
1 Replies

9. Shell Programming and Scripting

awk if condition match and print all

Hi, I am trying to do something like this ... I use awk to match a pattern, and then print out all col. My code is : awk '{if ($1 ==300) print $1,$2-'$sbin7',$3}' tmp.txt output= 300 2 whereby sbin7=2, The thing is, I want to print all col and row, not just the matched line/row only, but... (10 Replies)
Discussion started by: horsepower
10 Replies

10. Shell Programming and Scripting

awk if condition match and fix print decimal place

Hi All, I have problem in the middle of implementing to users, whereby the complaint is all about the decimal place which is too long. I need two decimal places only, but the outcome from command is always fixed to 6. See the sample : before: Sort Total Site Sort SortName Parts ... (3 Replies)
Discussion started by: horsepower
3 Replies
LIBPFM(3)						     Linux Programmer's Manual							 LIBPFM(3)

NAME
libpfm_intel_snbep_unc_pcu - support for Intel Sandy Bridge-EP Power Controller Unit (PCU) uncore PMU SYNOPSIS
#include <perfmon/pfmlib.h> PMU name: snbep_unc_pcu PMU desc: Intel Sandy Bridge-EP PCU uncore PMU DESCRIPTION
The library supports the Intel Sandy Bridge Power Controller Unit uncore PMU. This PMU model only exists on Sandy Bridge model 45. There is only one PCU PMU per processor socket. MODIFIERS
The following modifiers are supported on Intel Sandy Bridge C-Box uncore PMU: i Invert the meaning of the event. The counter will now count HA cycles in which the event is not occurring. This is a boolean modi- fier e Enable edge detection, i.e., count only when there is a state transition from no occurrence of the event to at least one occurrence. This modifier must be combined with a threshold modifier (t) with a value greater or equal to one. This is a boolean modifier. t Set the threshold value. When set to a non-zero value, the counter counts the number of HA cycles in which the number of occurrences of the event is greater or equal to the threshold. This is an integer modifier with values in the range [0:15]. ff Enable frequency band filtering. This modifier applies only to the UNC_P_FREQ_BANDx_CYCLES events, where x is [0-3]. The modifiers expects an integer in the range [0-255]. The value is interpreted as a frequency value to be multipled by 100Mhz. Thus if the value is 32, then all cycles where the processor is running at 3.2GHz and more are counted. Frequency band filtering There are 3 events which support frequency band filtering, namely, UNC_P_FREQ_BAND0_CYCLES, UNC_P_FREQ_BAND1_CYCLES, UNC_P_FREQ_BAND2_CYCLES, UNC_P_FREQ_BAND3_CYCLES. The frequency filter (available via the ff modifier) is stored into a PMU shared register which hold all 4 possible frequency bands, one per event. However, the library generate the encoding for each event individually because it processes events one at a time. The caller or the underlying kernel interface may have to merge the band filter settings to program the filter register properly. AUTHORS
Stephane Eranian <eranian@gmail.com> August, 2012 LIBPFM(3)
All times are GMT -4. The time now is 09:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy