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
ANTIWORD(1)							Linux User's Manual						       ANTIWORD(1)

NAME
antiword - show the text and images of MS Word documents SYNOPSIS
antiword [ options ] wordfiles DESCRIPTION
Antiword is an application that displays the text and the images of Microsoft Word documents. A wordfile named - stands for a Word document read from the standard input. Only documents made by MS Word version 2 and version 6 or later are supported. OPTIONS
-a papersize Output in Adobe PDF form. Printable on paper of the specified size: 10x14, a3, a4, a5, b4, b5, executive, folio, legal, letter, note, quarto, statement or tabloid. -f Output in formatted text form. That means that bold text is printed like *bold*, italics like /italics/ and underlined text as _underlined_. -h Give a help message. -i image level The image level determines how images will be shown. 0: Use non-standard extensions from Ghostscript. This output may not print on any PostScript printer, but is useful in case no hard copy is needed. It is also useful when Ghostscript is used as a filter to print a PostScript file to a non-PostScript printer. 1: Show no images. 2: PostScript level 2 compatible. (default) 3: PostScript level 3 compatible. (EXPERIMENTAL, Portable Network Graphics (PNG) images are not printed correctly) -m mapping file This file is used to map Unicode characters to your local character set. The default mapping file depends on the locale. -p papersize Output in PostScript form. Printable on paper of the specified size: 10x14, a3, a4, a5, b4, b5, executive, folio, legal, letter, note, quarto, statement or tabloid. -r Include text removed by the revisioning system. -s Include text with the so-called "hidden text" attribute. -t Output in text form. (default) -w width In text mode this is the line width in characters. A value of zero puts an entire paragraph on a line, useful when the text is to used as input for another wordprocessor. This value is ignored in PostScript mode. -x document type definition Output in XML form. Currently the only document type definition is db (for DocBook). -L In PostScript mode: use landscape mode. FILES
Mapping files like 8859-1.txt Antiword looks for its mapping files in three directories, in the order given: (1) The directory specified by $ANTIWORDHOME (2) The directory specified by $HOME/.antiword (3) Directory /usr/share/antiword The fontnames file Antiword will look for its fontname file in the same directories as used for the mapping files. The fontnames file contains the translation table from font names used by MS Word to font names used by PostScript. NOTE: Antiword cannot tell the difference between a file that does not exist and a file that cannot be opened for reading. ENVIRONMENT
Antiword uses the environment variable ``ANTIWORDHOME'' as the first directory to look for its files. Antiword uses the environment vari- able ``HOME'' to find the user's home directory. When in text mode it uses the variable ``COLUMNS'' to set the width of the output (unless overridden by the -w option). Antiword uses the environment variables ``LC_ALL'', ``LC_CTYPE'' and ``LANG'' (in that order) to get the current locale and uses this information to select the default mapping file. BUGS
Antiword is far from complete. Many features are still missing. Many images are not shown yet. Some of the images that are shown, are shown in the wrong place. PostScript output is only available in ISO 8859-1 and ISO 8859-2. WEB SITES
The most recent released version of Antiword is always available from: http://www.winfield.demon.nl/index.html or try http://antiword.cjb.net/ AUTHOR
Adri van Os <antiword@winfield.demon.nl> or try <comments@antiword.cjb.net> R.F. Smith <rsmith@xs4all.nl> and Sindi Keesan <keesan@cyberspace.org> contributed to this manual page. LICENSE
Antiword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL- ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ACKNOWLEDGEMENTS
Linux is a registered trademark of Linus Torvalds. Adobe, PDF and PostScript are trademarks of Adobe Systems Incorporated. Microsoft is a registered trademark and Windows is a trademark of Microsoft Corporation. Antiword 0.37 Oct 29, 2005 ANTIWORD(1)
All times are GMT -4. The time now is 05:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy