Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Select only certain lines from file and mantain formatting Post 302252922 by joeyg on Thursday 30th of October 2008 03:39:57 PM
Old 10-30-2008
Hammer & Screwdriver Here is one way

Code:
> cat file21
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

Code:
> sed "s/^STM/~STM/" file21 | tr "\n" "|" | tr "~" "\n" | cut -d"|" -f1,4

STMC221 (192.168.171.76)|No new software available.
STMC223 (192.168.23.25)|There are 1 updates to install
STMC225 (192.168.171.42)|There are 1 updates to install
STMC300 (192.168.171.240)|No new software available.
>

 

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
softwareupdate(8)					    BSD System Manager's Manual 					 softwareupdate(8)

NAME
softwareupdate -- system software update tool SYNOPSIS
softwareupdate command [args ...] DESCRIPTION
Software Update checks for new and updated versions of your software based on information about your computer and current software. Invoke softwareupdate by specifying a command followed by zero or more args. softwareupdate requires admin authentication for all commands except --list. If you run softwareupdate as a normal admin user, you will be prompted for a password where required. Alternatively, you can run softwareupdate as root and avoid all further authentication prompts. The following commands are available: -l | --list List all available updates. -i | --install Each update specified by args is downloaded and installed. args can be one of the following: -r | --recommended All updates that are recommended for your system. These are prefixed with a * character in the --list output. -R | --restart Automatically restart (or shut down) if required to complete installation. -a | --all All updates that are applicable to your system, including those non-recommended ones, which are prefixed with a - character in the --list output. (Non-recommended updates are uncommon in any case.) item ... One or more specified updates. The --list output shows the item names you can specify here, prefixed by the * or - characters. See EXAMPLES. -d | --download Each update specified by args is downloaded but not installed. The values of args are the same as for the --install command. Updates downloaded with --download can be subsequently installed with --install, or through the App Store (as long as they remain applicable to your system). Updates are downloaded to /Library/Updates, but are not designed to be installed by double-clicking the packages in that directory: always use --install or the App Store to actually perform the install. --ignore identifier ... Manages the per-machine list of ignored updates. The identifier is the first part of the item name (before the dash and version number) that is shown by --list. See EXAMPLES. --reset-ignored Clears the per-machine list of ignored updates. --schedule on | off Manages the per-machine automatic (background) check preference. -h | --help Print command usage. EXAMPLES
The following examples are shown as given to the shell: softwareupdate --list Software Update Tool Finding available software Software Update found the following new or updated software: * MacBookAirEFIUpdate2.4-2.4 MacBook Air EFI Firmware Update (2.4), 3817K [recommended] [restart] * ProAppsQTCodecs-1.0 ProApps QuickTime codecs (1.0), 968K [recommended] * JavaForOSX-1.0 Java for OS X 2012-005 (1.0), 65288K [recommended] sudo softwareupdate --install JavaForOSX-1.0 Software Update Tool Finding available software Downloading Java for OS X 2012-005 Downloaded Java for OS X 2012-005 Installing Java for OS X 2012-005 Done with Java for OS X 2012-005 Done. sudo softwareupdate --ignore JavaForOSX Ignored updates: (JavaForOSX) sudo softwareupdate --schedule Automatic check is on Mac OS September 11, 2012 Mac OS
All times are GMT -4. The time now is 09:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy