Sponsored Content
Top Forums Shell Programming and Scripting Retrieve lines that match any occurence in a list of patterns Post 302693369 by Selftaught on Wednesday 29th of August 2012 05:39:33 AM
Old 08-29-2012
Here it is:
Image
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed/awk help to match list of patterns and remove from org file

Hi, From the pattern mentioned below remove lines based on pattern range. Conditions 1 Look For all lines starting with ALTER TABLE and Ending with ; and contains the word MOVE.I wanto to remove these lines from the file sample below. Note : The above pattern list could be found in... (1 Reply)
Discussion started by: rajan_san
1 Replies

2. UNIX for Dummies Questions & Answers

retrieve lines that match a pattern

Hi, I would like to know how can I get lines from a text file that match no more than 2 '>'. Example: Input file: a >cr1 4 a>b b>c a >cr2 5 a>b Output file: a >cr2 5 a>b Thanks in advance (2 Replies)
Discussion started by: fadista
2 Replies

3. Shell Programming and Scripting

Removing file lines that each match to a different patterns

I have a very large file (10,000,000 lines), that contains a sample id and a property of that sample. I have another file that contains around 1,000,000 lines with sample ids that I want to remove from the original file (create a new file without these lines). I know how to do this in Perl, but it... (9 Replies)
Discussion started by: Jo_puzzled
9 Replies

4. Shell Programming and Scripting

print lines which match multiple patterns

Hi, I have a text file as follows: 11:38:11.054 run1_rdseq avg_2-5 999988.0000 1024.0000 11:50:52.053 run3_rdrand 999988.0000 1135.0 128.0417 11:53:18.050 run4_wrrand avg_2-5 999988.0000 8180.5833 11:55:42.051 run4_wrrand avg_2-5 999988.0000 213.8333 11:55:06.053... (2 Replies)
Discussion started by: annazpereira
2 Replies

5. Shell Programming and Scripting

How to get line after occurence of sequence of patterns

In the past I needed a help with the problem how to search for pattern after the occurence of another pattern which is described in this thread: https://www.unix.com/shell-programmin...-pattern1.html Now I would need something quite similar, only the pattern which is to be searched must be... (3 Replies)
Discussion started by: sameucho
3 Replies

6. Shell Programming and Scripting

sed print between 2 patterns only last occurence

Hi, I have a file, which contains the following log data. I am trying to print fromt he file the following data: I have tried using sed, but I am getting from the first pattern Thanks for your help. (5 Replies)
Discussion started by: sol_nov
5 Replies

7. Shell Programming and Scripting

Print between patterns - first occurence, second occurence etc

I have a file # cat asasas AAAAAA 11 22 33 44 BBBBB NILNILNIL AAAAAA 22 33 44 55 66 77 88 BBBBB NILNILNIL (2 Replies)
Discussion started by: anil510
2 Replies

8. UNIX for Advanced & Expert Users

Get the first occurence between two patterns

I have an output file which gives me the timely status of a server. Sample file: March 11 2014 21:10, 1, 2, 3, 4, 5, 6, 7, 8, 9, x, y, z... 21:05, 1, 2, 3, 4, 5, 6, 7, 8, 9, x, y, z... 21:00, 1, 2, 3, 4,... (3 Replies)
Discussion started by: rpm120
3 Replies

9. Shell Programming and Scripting

Match 2 different patterns and print the lines

Hi, i have been trying to extract multiple lines based on two different patterns as below:- file1 @jkm|kdo|aas012|192.2.3.1 blablbalablablkabblablabla sjfdsakfjladfjefhaghfagfkafagkjsghfalhfk fhajkhfadjkhfalhflaffajkgfajkghfajkhgfkf jahfjkhflkhalfdhfwearhahfl @jkm|sdf|wud08q|168.2.1.3... (8 Replies)
Discussion started by: redse171
8 Replies

10. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies
CONFGET(1)						    BSD General Commands Manual 						CONFGET(1)

NAME
confget -- read a variable from a configuration file SYNOPSIS
confget [-cSx] [-N | -n] [-f filename] [-m pattern] [-P postfix] [-p prefix] [-s section] [-t type] varname... confget [-] [-N | -n] [-f filename] [-m pattern] [-P postfix] [-p prefix] [-s section] [-t type] -L pattern... confget [-] [-N | -n] [-f filename] [-m pattern] [-P postfix] [-p prefix] [-s section] [-t type] -l confget [-hTV] DESCRIPTION
The confget utility examines a INI-style configuration file and retrieves the value of the specified variables from the specified section. Its intended use is to let shell scripts use the same INI-style configuration files as other programs, to avoid duplication of data. The confget utility may retrieve the values of one or more variables, list all the variables in a specified section, list only those whose names or values match a specified pattern (shell glob or regular expression), or check if a variable is present in the file at all. It has a ``shell-quoting'' output mode that quotes the variable values in a way suitable for passing them directly to a Bourne-style shell. Options: -c Check-only mode; exit with a code of 0 if any of the variables are present in the configuration file, and 1 if there are none. -f filename Specify the configuration file to read from, or ``-'' (a single dash) for standard input. -h Display program usage information and exit. -L Variable list mode; display the names and values of all variables in the specified section with names matching one or more specified patterns. -l List mode; display the names and values of all variables in the specified section. -m pattern Only display variables with if their values match the specified pattern. -N Always display the variable name along with the value. -n Never display the variable name, only the value. -P postfix Display this string after the variable name as a postfix. -p prefix Display this string before the variable name as a prefix. -S Quote the variable values so that the ``var=value'' lines may be passed directly to the Bourne shell. -s section Specify the configuration section to read. If this option is not specified, confget will use the first section found in the configuration file. However, if the configuration file contains variable definitions before a section header, confget will only examine them instead. -T List the available configuration file types that may be selected by the -t option. -t type Specify the configuration file type. -V Display program version information and exit. -x Treat the patterns as regular expressions instead of shell glob patterns. ENVIRONMENT
Not taken into consideration. EXIT STATUS
If the -c option is specified, the confget utility will exit with a status of 0 if any of the specified variables exist in the config file and 1 if none of them are present. In normal operation, no matter whether any variables were found in the configuration file or not, the confget utility exits with a status of 0 upon normal completion. If any errors should occur while accessing or parsing the configuration file, the confget utility will display a diagnostic message on the standard error stream and exit with a status of 1. EXAMPLES
Retrieve the variable machine_id from the system section of a configuration file: confget -f h.conf -s system machine_id Retrieve the page_id variable from an HTTP GET request, but only if it is a valid number: confget -f- -t http_get -x -m '^+$' page_id Retrieve the variable hostname from the db section, but only if it ends in ``.ringlet.net'': confget -f h.conf -s db -m '*.ringlet.net' hostname Display the names and values of all variables in the system section with names beginning with ``mach'' or ending in ``name'', appending a ``cfg_'' at the start of each variable name: confget -f h.conf -s system -p 'cfg_' -L 'mach*' '*name' Display the names and values of all variables in the system section: confget -f h.conf -s system -l Safely read the contents of the db section: eval `confget -f h.conf -s db -p db_ -S -l` SEE ALSO
For another way to parse INI files, see the Config::IniFiles(3) Perl module. STANDARDS
No standards documentation was harmed in the process of creating confget. BUGS
Please report any bugs in confget to the author. AUTHOR
The confget utility was conceived and written by Peter Pentchev <roam@ringlet.net> in 2008. BSD
October 25, 2008 BSD
All times are GMT -4. The time now is 08:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy