Sponsored Content
Top Forums Shell Programming and Scripting search and goto next line then take the output Post 302340193 by Franklin52 on Monday 3rd of August 2009 03:39:20 AM
Old 08-03-2009
Another approach:

Code:
awk -F, 'NR>1{OFS="|";$1=$1}/Static Addresses/{exit}{print}' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

2. Shell Programming and Scripting

Search a line and output next line as well

Hi, I have a requirement to search a particular text and if found print next line also. Appreciate your help. Thanks (10 Replies)
Discussion started by: kamranjalal
10 Replies

3. Shell Programming and Scripting

perl search and replace - search in first line and replance in 2nd line

Dear All, i want to search particular string and want to replance next line value. following is the test file. search string is tmp,??? ,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50 tmp,123 --- if match tmp,??? then... (3 Replies)
Discussion started by: arvindng
3 Replies

4. Shell Programming and Scripting

Search: find current line, then search back

Hello. I want to find a line that has "new = 0" in it, then search back based on field $4 () in the current line, and find the first line that has field $4 and "last fetch" Grep or Awk preferred. Here is what the data looks like: 2013-12-12 12:10:30,117 TRACE last fetch: Thu Dec 12... (7 Replies)
Discussion started by: JimBurns
7 Replies

5. Shell Programming and Scripting

(n)awk: print regex search output lines in one line

Hello. I have been looking high and low for the solution for this. I seems there should be a simple answer, but alas. I have a big xml file, and I need to extract certain information from specific items. The information I need can be found between a specific set of tags. let's call them... (2 Replies)
Discussion started by: Tobias-Reiper
2 Replies

6. Shell Programming and Scripting

Bash to goto specific line/function and start processing if user response is yes

In the bash below I am trying to run the script entire script including the ....(which is a bunch of code) and then in the run function if the user response is y (line in bold). then start processing from execute function. Basically, goto the # extract folder for variable filename line and start... (4 Replies)
Discussion started by: cmccabe
4 Replies

7. Shell Programming and Scripting

A dash to GOTO or a dash from GOTO, that is the question...

Well, guys I saw a question about GOTO for Python. So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too). Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'... This is purely a fun project to see if it is possible in PURE... (3 Replies)
Discussion started by: wisecracker
3 Replies

8. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies

9. Web Development

302 Redirects Issues Effected Google Search Console (GSC) Fixed - DBSEO Goto Rewrite Problems Solved

Finally! Yesterday I FINALLY figured out why Google Search Console (GSE) was showing so many pages with 302 redirects in our link budget. For over a year, I thought this issue was relate to either Apache2 or DBSEO (our PHP module which rewrites our links to be SEO friendly). However, when I... (5 Replies)
Discussion started by: Neo
5 Replies

10. UNIX for Beginners Questions & Answers

Search a multi-line shell command output and execute logic based on result

The following is a multi-line shell command example: $cargo build Compiling prawn v0.1.0 (/Users/ag/rust/prawn) error: failed to resolve: could not find `setup_panix` in `human_panic` --> src/main.rs:14:22 | 14 | human_panic::setup_panix!(); | ... (2 Replies)
Discussion started by: yogi
2 Replies
mh-alias(5mh)															     mh-alias(5mh)

Name
       mh-alias - alias file for MH message system

Description
       Aliasing  allows  you to send mail to a person or group of persons without typing their complete mail address.  Both your MH personal alias
       file and the system alias file for mail delivery, process aliases in the same way.  You can specify the name of your personal alias file in
       your

       A line of the alias file can have the following formats:
       alias : address-group
       alias ; address-group
       < alias-file

       The  first  line  of  the example is the standard format.  The alias appears at the start of the line, followed by a colon, followed by the
       address or addresses that it represents.

       If the alias is terminated with a semicolon (;) instead of a colon (:), the mail system outputs both the alias and the address-list in  the
       correct format.

       If  the	line  starts with a <, the file named after the < is read for more alias definitions.  The reading is done recursively, so a < can
       occur in the beginning of an alias file with the expected results.

       Addresses can be expressed in the following formats:
       alias: address1, address2, address3, ...
       alias: <file
       alias: =ULTRIX-group
       alias: +ULTRIX-group
       alias: *

       Addresses are normally given in a list, separated by a comma and one or more spaces.  If the list goes over one line, you can create a con-
       tinuation line by placing a back-slash () immediately before the new-line character.

       If the address-group begins with a <, the file named after the < is read and its contents added to the address list for the alias.

       If  the	address-group starts with an =, then the file is consulted for the ULTRIX-group named after the =.  Each login name occurring as a
       member of the group is added to the address list for the alias.

       If the address-group starts with a +, then the file is consulted to determine the group-id of the ULTRIX-group named  after  the  +.   Each
       login name occurring in the file whose group-id is indicated by this group is added to the address list for the alias.

       If  the	address-group is simply *, then the file is consulted and all login names with a user-id greater than a given number (usually 200)
       are added to the address list for the alias.

       Aliases are resolved at posting time in the following way.  A list of all the addresses from the message is built and  duplicate  addresses
       are  eliminated.   If  the message originated on the local host, then alias resolution is performed for those addresses in the message that
       have no host specified.	For each line in the alias file, aliases are compared against all of the existing addresses.  If there is a match,
       the  matched  alias  is removed from the address list, and each new address in the address-group is added to the address list, if it is not
       already on the list.

       The alias itself is not usually output; the address-group that the alias maps to is output instead.  However, if the  alias  is	terminated
       with a semicolon (;) instead of a colon (:), both the alias and the address are output in the correct format.  This makes replies possible,
       because in MH aliases and personal aliases are unknown to the mail transport system.

       MH alias files are expanded into the headers of messages posted.  This aliasing occurs first, at posting time, without the knowledge of the
       message	transport  system.   In contrast, once the message transport system is given a message to deliver to a list of addresses, for each
       address that appears to be local, a system-wide alias file is consulted.  These aliases are not	expanded  into	the  headers  of  messages
       delivered.

       An alias file must not reference itself directly, or indirectly through another alias file, using the <file construct.

   Using Aliasing
       To  use aliasing in MH, you need to set up a personal alias file.  It can have any name, but it is usually called and is usually located in
       your Mail directory.  To set up the file, you need to perform the following steps.

       First, add the following line to your
       Aliasfile: aliases
       If you have chosen a different name for your file, you should use this instead of If your file is in  a	directory  other  than	your  Mail
       directory, you must supply the full pathname.

       Next, create the file in your Mail directory.

       You can now start to add aliases to your file.

Examples
       This section gives an example of an alias file, followed by an explanation of the entries:
       sgroup: fred, fear, freida
       fred: frated@UCI
       ULTRIX-committee: <ultrix.aliases
       staff: =staff
       wheels: +wheel
       everyone: *

       On  the	first  line of the example, sgroup is defined as an alias for the three names frated@UCI, fear, and freida.  On the second line of
       the example, fred is defined as an alias for  frated@UCI.   Next,  the  definition  of  ULTRIX-committee  is  given  by	reading  the  file
       ultrix.aliases  in  your Mail directory.  The alias staff is defined as all users who are listed as members of the group staff in the file.
       The alias wheels is defined as all users whose group-id in is equal to the group wheel.	Finally, the alias  everyone  is  defined  as  all
       users with a user-id in greater than 200.

Files
       System alias file.

       Your user profile.

See Also
       ali(1mh), send(1mh), whom(1mh), group(5), passwd(5), mh_profile(5mh), mtstailor(5mh), conflict(8mh), post(8mh)

																     mh-alias(5mh)
All times are GMT -4. The time now is 03:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy