Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Select only certain lines from file and mantain formatting Post 302252911 by glev2005 on Thursday 30th of October 2008 03:01:08 PM
Old 10-30-2008
Select only certain lines from file and mantain formatting

I want to take the below data, and have it output to file only the STMC#/(IP address) and the "there are X number of updates to install" lines for each machine. I know it's easy, but Im a beginner in BASH stuff, my solution would probably take way too many lines to do something easy.Thanks!


STMC221 (192.168.171.76)
Password:
2008-10-30 14:38:49.495 softwareupdate[360] Loading CatalogURL http://mysus.company.lan:8088/index.sucatalog
No new software available.
There are no updates to install


STMC223 (192.168.23.25)
Password:
2008-10-30 14:38:29.245 softwareupdate[11526] Loading CatalogURL http://mysus.company.lan:8088/index.sucatalog
There are 1 updates to install


STMC225 (192.168.171.42)
Password:
2008-10-30 14:38:30.813 softwareupdate[3084] Loading CatalogURL http://mysus.company.lan:8088/index.sucatalog
There are 1 updates to install


STMC300 (192.168.171.240)
Password:
2008-10-30 14:38:31.661 softwareupdate[9255] Loading CatalogURL http://mysus.company.lan:8088/index.sucatalog
No new software available.
There are no updates to install
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

formatting the sql select result

Hi, I have about 12 columns and 15 rows to be retrived from sybase isql command through unix. But when i output the sql into a file and see it, the formatting is going for a toss. can someone please suggest how can i get the result correctly in the output file ? Thanks, Sateesh (2 Replies)
Discussion started by: kotasateesh
2 Replies

2. Shell Programming and Scripting

Select some lines from a txt file and create a new file with awk

Hi there, I have a text file with several colums separated by "|;#" I need to search the file extracting all columns starting with the value of "1" or "2" saving in a separate file just the first 7 columns of each row maching the criteria, with replacement of the saparators in the nearly created... (4 Replies)
Discussion started by: capnino
4 Replies

3. Shell Programming and Scripting

Select lines in which column have value greater than some percent of total file lines

i have a file in following format 1 32 3 4 6 4 4 45 1 45 4 61 54 66 4 5 65 51 56 65 1 12 32 85 now here the total number of lines are 8(they vary each time) Now i want to select only those lines in which the values... (6 Replies)
Discussion started by: vaibhavkorde
6 Replies

4. Shell Programming and Scripting

sql select command output formatting in shell script

Hi, I need to connect to the database and retrieve two variables from the database and store them in a variable,out of these two variables I need to get lastdigit appended to the variable 1 retrieved and variable 2 with out any modification in short select var,data from usage; o/p=... (1 Reply)
Discussion started by: rkrish
1 Replies

5. UNIX for Dummies Questions & Answers

how to select lines from one file based on another file

Hi, I would like to know how can I select lines of one file based on a common ID column from another file (keeping the order of the second file). Example of file1: ID A B C D 1-30 1 2 3 5-60 4 5 6 1-20 7 8 9 Example of file2: ID chr pos 1-20 1 20 1-30 1 30 5-60 5 60 Desired... (2 Replies)
Discussion started by: fadista
2 Replies

6. UNIX for Dummies Questions & Answers

How to randomly select lines from a text file

I have a text file with 1000 lines, I want to randomly select 200 lines from it and print them as output. How do I go about doing that? Thanks! (7 Replies)
Discussion started by: evelibertine
7 Replies

7. Shell Programming and Scripting

Short program to select lines from a file based on a second file

Hello, I use UBUNTU 12.04. I want to write a short program using awk to select some lines in a file based on a second file. My first file has this format with about 400,000 lines and 47 fields: SNP1 1 12.1 SNP2 1 13.2 SNP3 1 45.2 SNP4 1 23.4 My second file has this format: SNP2 SNP3... (1 Reply)
Discussion started by: Homa
1 Replies

8. Shell Programming and Scripting

Select lines from a file based on a criteria

Hi I need to select lines from a txt file, I have got a line starting with ZMIO:MSISDN= and after a few line I have another line starting with 'MOBILE STATION ISDN NUMBER' and another one starting with 'VLR-ADDRESS' I need to copy these three lines as three different columns in a separate... (3 Replies)
Discussion started by: Tlcm sam
3 Replies

9. Shell Programming and Scripting

awk - mixed for and if to select particular lines in a data file

Hi all, I am new to AWK and I am trying to solve a problem that is probably easy for an expert. Suppose I have the following data file input.txt: 20 35 43 20 23 54 20 62 21 20.5 43 12 20.5 33 11 20.5 89 87 21 33 20 21 22 21 21 56 87 I want to select from all lines having the... (4 Replies)
Discussion started by: naska
4 Replies

10. Shell Programming and Scripting

Select only the lines of a file starting with a field which is matcing a list. awk?

Hello I have a large file1 which has many events like "2014010420" and following lines under each event that start with text . It has this form: 2014010420 num --- --- num .... NTE num num --- num... EFA num num --- num ... LASW num num --- num... (9 Replies)
Discussion started by: phaethon
9 Replies
colcrt(1)						      General Commands Manual							 colcrt(1)

Name
       colcrt - filter nroff output for CRT previewing

Syntax
       colcrt [-] [-2] [file...]

Description
       The  command provides virtual half-line and reverse line feed sequences for terminals without such capability, and on which overstriking is
       destructive.  Half-line characters and underlining (changed to dashing `-') are placed on new lines in between the normal output lines.

Options
       -  Suppresses all underlining.  It is especially useful for previewing allboxed tables from

       -2 Causes half-lines to be printed, double spacing the output.  Normally, a minimal space output format is used which will  suppress  empty
	  lines.   The	program  never	suppresses  two  consecutive empty lines, however.  The -2 option is useful for sending output to the line
	  printer when the output contains superscripts and subscripts which would otherwise be invisible.

Examples
       A typical use of would be:
       tbl exum2.n | nroff -ms | colcrt - | more

Restrictions
       Can't back up more than 102 lines.

       General overstriking is lost; as a special case `|' overstruck with `-' or underline becomes `+'.

       Lines are trimmed to 132 characters.

See Also
       col(1), more(1), nroff(1), ul(1)

																	 colcrt(1)
All times are GMT -4. The time now is 02:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy