Sponsored Content
Top Forums Shell Programming and Scripting awk if statement matching all lines starting w/ a number Post 302363231 by Arsenalman on Monday 19th of October 2009 07:03:40 PM
Old 10-19-2009
Finally hit the jack pot. again thank you for your contribution which help me move forward along to my destination:

Code:
{
if (sub(/DISCOVERY=ON/, "DISCOVERY=OFF"))
print $0
if ( $1 ~ /^#/ ) {
        print $0 }
if ( NF == 4 ){
    if ( system("test -d " $4) ) {
         }
    else {
        print "1        0       0       "$4 "\n" }
}
}



---------- Post updated at 06:03 PM ---------- Previous update was at 05:29 PM ----------

n1djs & scottn finally hit the jack pot. Again thank you for your contribution which help me move forward along to my destination:

Code:
{
if (sub(/DISCOVERY=ON/, "DISCOVERY=OFF"))
   print $0
if ( $1 ~ /^#/ ) {
   print $0 }
if ( NF == 4 ){
   if ( system("test -d " $4) ) {
         }
   else {
        print "1        0       0       "$4 "\n" }
}
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I get an if statement to execute based on number of lines in a file?

I need to have an if statement in a script to run if there are certain processes running. Easiest way I can see to do this is to run a ps and grep the results based on what I am looking for: $ ps -ef | grep wtrs --- webtrend 5046 1 0 May 12 ? 0:28 /webtrends/versions/6.1/wtrs_ui... (6 Replies)
Discussion started by: LordJezo
6 Replies

2. Shell Programming and Scripting

How to print the number of lines from a file, the starting string should be passed`

Hi , I have file, which has the below content: line 100 a b c d line300 a s d f s line200 a s d a (3 Replies)
Discussion started by: little_wonder
3 Replies

3. Shell Programming and Scripting

awk statement to match all lines starting with "#"

Looking for awk statement that will match all lines starting with "# " if ( $1 == \^"#" ) Input file: # of the server. If you would like to set these, please take out the # pound (#) sign in front of one or all severities and set it equal to # severity desired. For example, FATAL=3 #... (2 Replies)
Discussion started by: Arsenalman
2 Replies

4. Emergency UNIX and Linux Support

Urgent help pls.how to extract two lines having same starting number

Hi , I have a huge file like this =245 this is testing =035 abc123 =245 this is testing1 =035 abc124 =245 this is testing2 =035 abc125 =035 abc126 =245 this is testing3 here i have to pull out those lines having two =035 instead of alternative 035 and 245 i.e extract... (18 Replies)
Discussion started by: umapearl
18 Replies

5. Solaris

awk - Print variable number of colums from a starting column

Hi guys, I usualy am able to google awk stuff but I can't find it so far and there are so many awking gurus here that I will give it a shot. I want to print $1;$3;"$5 up to the $NF". In other words, I can have 1000 colums, but need to have $5 up to the end. I started with the idea of... (2 Replies)
Discussion started by: plmachiavel
2 Replies

6. Shell Programming and Scripting

Awk, sed - concatenate lines starting with string

I have a file that looks like this: John Smith http://www.profile1.com http://www.profile2.com http://www.profile3.com Marc Olsen http://www.profile4.com http://www.profile5.com http://www.profile6.com http://www.profile7.com Lynne Doe http://www.profile8.com http://www.profile9.com... (3 Replies)
Discussion started by: locoroco
3 Replies

7. Shell Programming and Scripting

Compare two files and count number of matching lines

Dear All, I would like to compare two files and return the number of matches found. Example File A Lx2 L1_Mus1 L1Md_T Lx5 L1M2 L1_Mus3 Lx3_Mus Lx9 Lx2A L1Md_A L1Md_F2 File B L1_Mus3 L1_Mus3 (3 Replies)
Discussion started by: paolo.kunder
3 Replies

8. Shell Programming and Scripting

Matching and Replacing file lines starting with $

Here is the task that I was presented with: I am dealing with about a 10,000 line input deck file for an analysis. About 10 separate blocks of around 25 lines of code each need to be updated in the input deck. The input deck (deckToChange in the code below) comes with 2 separate files. File 1... (5 Replies)
Discussion started by: tiktak292
5 Replies

9. 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

10. UNIX for Dummies Questions & Answers

Grep -v lines starting with pattern 1 and not matching pattern 2

Hi all! Thanks for taking the time to view this! I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern. Example: Drink a soda Eat a banana Eat multiple bananas Drink an apple juice Eat an apple Eat multiple apples I... (8 Replies)
Discussion started by: demmel
8 Replies
lpmove(1M)						  System Administration Commands						lpmove(1M)

NAME
lpmove - move print requests SYNOPSIS
lpmove [request-ID] destination lpmove destination1 destination2 DESCRIPTION
The lpmove command moves print requests queued by lp(1) or lpr(1B) between destinations. The first form of lpmove moves specific print requests (request-ID) to a specific destination. The second form of the lpmove command moves all print requests from one destination (destination1) to another (destination2). This form of lpmove also rejects new print requests for destination1. lpmove moves individual requests or entire queues only between local printers or between remote printers, not between a local and a remote printer. You can move only requests that were not previously transferred to the server. When moving requests, lpmove does not check the acceptance status of the destination to which the print requests are being moved (see accept(1M)). lpmove does not move requests that have options (for example, content type or requiring a special form) that cannot be handled by the new destination. OPERANDS
The following operands are supported: request-ID The specific print request to be moved. Specify request-ID as the identifier associated with a print request as reported by lpstat. See lpstat(1). destination The name of the printer or class of printers (see lpadmin(1M)) to which lpmove moves a specified print request. Specify destination using atomic, POSIX-style (server:destination) syntax. destination1 The name of the destination from which lpmove moves all print requests. Specify destination using atomic, POSIX-style (server:destination) syntax. destination2 The name of the destination to which lpmove moves all print requests. Specify destination using atomic, POSIX-style (server:destination) syntax. See printers.conf(4) for information regarding the naming conventions for atomic names and standards(5) for information regarding POSIX. EXIT STATUS
The following exit values are returned: 0 Successful completion. non-zero An error occurred. FILES
/var/spool/print/* LP print queue. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpcu | +-----------------------------+-----------------------------+ SEE ALSO
lp(1), lpr(1B), lpstat(1), accept(1M), lpadmin(1M), lpsched(1M), printers.conf(4), attributes(5), standards(5) System Administration Guide: Advanced Administration SunOS 5.10 8 Feb 2001 lpmove(1M)
All times are GMT -4. The time now is 08:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy