05-20-2013
You're quite welcome.
Regards,
Alister
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to do some thing like this ..
In a file , if pattern found insert new pattern at the begining of the line containing the pattern.
example:
in a file I have this.
gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin
if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies
2. Shell Programming and Scripting
I am trying to pull certain pieces of data out of a line of a file that matches a certain pattern:
The three pieces that I want to pull out of this line are the only occurrences of that pattern within the line, but the rest of the line is not consistent in each file. Basically the line is... (3 Replies)
Discussion started by: ellhef
3 Replies
3. Shell Programming and Scripting
I have the following text format in a file which lists the question first and then 5 choices
after that the explanantion and finally the answer.
1.The amount of time it takes for most of a worker’s occupational knowledge and skills to become
obsolete has been declining because of the... (2 Replies)
Discussion started by: nanchil_guy
2 Replies
4. Shell Programming and Scripting
Hi Experts,
Help needed on joining one line above & below to the pattern matched string line.
The input file, required output is mentioned below
Input file
ABCD DEFG5 42.0.1-63.38.31
KKKK iokl IP Connection Available
ABCD DEFG5 42.0.1-63.38.31
... (7 Replies)
Discussion started by: krao
7 Replies
5. Shell Programming and Scripting
Hi All,
I am stuck for quite sometime now. Below is a line in my file -
GS|ED|001075|001081|20110626|1806|100803|X|004010ST|130|100803001
This line occurs only once and it is the second line.
I have to break this line into two lines from ST (bold) such that it looks like -... (5 Replies)
Discussion started by: ihussain
5 Replies
6. Shell Programming and Scripting
Hi,
I am getting crazy after days on looking at it:
Bash in Ubuntu 12.04.1
I want to do this:
pattern="system /path1/file1 file1"
new_pattern=" data /path2/file2 file2"
file to edit: data.db
- I need to search in the file data.db for the nth occurrence of pattern
- pattern must... (14 Replies)
Discussion started by: Phil3759
14 Replies
7. Shell Programming and Scripting
Hi,
I have two files file1.txt and file2.txt. Please see the attachments.
In file2.txt (which actually is a diff output between two versions of file1.txt.), I extract the pattern corresponding to 1172c1172. Now ,In file1.txt I have to search for this pattern 1172c1172 and if found, I have to... (9 Replies)
Discussion started by: saurabh kumar
9 Replies
8. Shell Programming and Scripting
Hello Friends,
I need to print lines in between two string when a keyword existed in those lines (keywords like exception, error, failed, not started etc).
for example,
input:
..
Begin Edr
ab12
ac13
ad14
bc23
exception occured
bd24
cd34
dd44
ee55
ff66
End Edr (2 Replies)
Discussion started by: EAGL€
2 Replies
9. UNIX for Advanced & Expert Users
Hi I want to print the line until pattern is matched.
I am using below code:
sed -n '1,/pattern / p' file
It is working fine for me , but its not working for exact match.
sed -n '1,/^LAC$/ p' file
Input:
LACC FEGHRA 0
LACC FACAF 0
LACC DARA 0
LACC TALAC 0
LAC ILACTC 0... (8 Replies)
Discussion started by: Abhisrajput
8 Replies
10. Shell Programming and Scripting
Hello,
I have below format log file,
Comparing csv_converted_files/2201/9747.1012H67126.5077292103609547345.csv and csv_converted_files/22019/97447.1012H67126.5077292103609547345.csv
Comparing csv_converted_files/2559/9447.1012H67126.5077292103609547345.csv and... (6 Replies)
Discussion started by: arvindshukla81
6 Replies
LEARN ABOUT DEBIAN
regexp-assemble
REGEXP-ASSEMBLE(1p) User Contributed Perl Documentation REGEXP-ASSEMBLE(1p)
NAME
regexp-assemble - Assemble a list of regular expressions from a file
SYNOPSIS
regexp-assemble -abcdfinprsStTuUvw file [...]
DESCRIPTION
Assemble a list of regular expression either from standard input or a file, using the Regexp::Assemble module.
OPTIONS
-a look Ahead. Insert "(?=...)" zero-width lookahead assertions in the pattern, where necessary.
-b Blank. Ignore blank lines.
-c Comment. Basic comment filtering. Strip off perl/shell comments ("s*#.*$/").
-d Debug. Turns on debugging output. See Regexp::Assemble for suitable values.
-i Indent. Print the regular expression using and indent of n to display nesting. A.k.a pretty-printing. Implies -p.
-n No newline. Do not print a newline after the pattern. Useful when interpolating the output into a templating system or similar.
-p Print. Print the pattern. This is the default, however, it is required when the -t switch is enabled (because if you want to test
patterns ordinarily you don't care what the the assembled pattern looks like).
-r Reduce. The default behaviour is to reduce the assembled pattern. Enabling this switch causes the reduction algorithm to be switched
off. This can help you determine how much reduction is performed.
regexp-assemble pattern.file | wc
# versus
regexp-assemble -r pattern.file | wc
-s Statistics. Print some statistics about the assembled pattern. The output is sent to STDERR (in order to allow the generated pattern
to be redirected elsewhere).
-S Statistics only. Like -s, except that the pattern itself is not output. Useful with -d 8 to see the time taken.
-t Test. Test the assembled expression against the contents of a file. Each line is read from the file and is matched against the
pattern. Lines that fail to match are printed. In other words, no output is good output. In this mode of operation, error status is 1
in the case of a failure, 0 if all lines matched.
-T Time. Print statistics on the time taken to reduce and assemble the pattern. (This is merely a lazy person's synonym for "-d 8").
-u Unique. Carp if duplicate patterns are found.
-U Unroll. Transform "a+" et al into "aa*" (which may allow additional reductions).
-v Version. Print the version of the regexp-assemble script.
-w Word/Whole. When testing the contents of a file with "-t", bracket the expression with "^" and "$" in order to match the whole word or
line from the file.
DIAGNOSTICS
Will print out a summary of the problem if an added pattern causes the assembly to fail.
SEE ALSO
Regexp::Assemble
AUTHOR
Copyright (C) 2004-2008 David Landgren. All rights reserved.
LICENSE
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-06-30 REGEXP-ASSEMBLE(1p)