Could any one tell me how to read and match multiple lines in perl? Did this code below still work in this situation?
while (<FILE>) {
if (/ /) {
}
}
Thanks a lot! (5 Replies)
I made a script that can swap info on two lines using a combination of awk and sed, but was hoping to consolidate the script to make it run faster. If found this script, but can't seem to get it to work in a bash shell. I keep getting the error "Too many {'s". Any help here would be appreciated:... (38 Replies)
First of all, I know this can be more eassily done with perl or other scripting languages but, that's not the issue. I need this in sed. (or wander if it's possible )
I got a file (trace file to recreate the control file from oracle for the dba boys)
which contains
some lines
another line... (11 Replies)
Hi folks,
I have a text file that I need to parse, and I cant figure it out. The source is a report breaking down softwares from various companies with some basic info about them (see source snippet below). Ultimately what I want is an excel sheet with only Adobe and Microsoft software name and... (5 Replies)
Greetings all,
I am trying to match a string, and after that insert a few lines above that match.
The string is "Version 1.0.0". I need to insert a few lines ONLY above the first match (there are many Version numbers in the file). The rest of the matches must be ignored. The lines I need to... (2 Replies)
Hello,
Could someone help me with sed. I have searched for solution 5 days allready :wall:, but cant find. Unfortunately my "sed" knowledge not good enough to manage it. I have the text:
123, foo1, bar1, short text1, dat1e, stable_pattern
124, foo2, bar2, long text
with few
lines, date,... (4 Replies)
I want to do something like sed -n '/PATTERN/,+10p' and get the ten lines following PATTERN. However, this throws an "expected context address" with the sed that comes with OSX Lion. If that + is a GNUism, can I do this, or do I have to find another tool? (2 Replies)
Discussion started by: jnojr
2 Replies
LEARN ABOUT DEBIAN
txt2regex
TXT2REGEX(1) General Commands Manual TXT2REGEX(1)NAME
txt2regex - a Regular Expression Wizard, written with bash2 builtins
SYNOPSIS
txt2regex
txt2regex --nocolor|--whitebg
txt2regex --all|--prog <p1,p2,...,pN>
txt2regex --showmeta|--showinfo <program>
txt2regex --make <target>
txt2regex --history <value>
DESCRIPTION
txt2regex is a Regular Expression "wizard", all written with bash2 builtins, that converts human sentences to regexes.
With a simple interactive interface, you just answer to questions and build your own regex for a large variety of programs, like awk,
emacs, grep, perl, php, procmail, python, sed and vim. There are more than 20 supported programs.
It's bash so download and run, no compilation needed.
Please visit the program homepage at http://txt2regex.sf.net.
OPTIONS --all works with all registered programs
--help prints the help message and quit
--history <value>
prints to STDOUT a regex from a history data
--make <target>
prints a ready regex for a common pattern
--nocolor
self-explanatory
--prog <p1,p2,...>
choose which programs to use (separated by commas)
--showinfo <program>
prints regex info about the program
--showmeta
prints a complete metachar table for all programs
--version
prints the program version and quit
--whitebg
colors adjusted to white background terminals
By default, all options are turned OFF. Just call it with no options to launch the default interactive interface.
DETAILS --all is cool but requires lots of lines (~35)
--nocolor is strong, so it kills --whitebg
--showmeta rules, try it
--showinfo uses reverse video output, --nocolor turns it off
--history is getting useful, stay tunned
--make is a remedy for headaches
--prog is nice to use your favorite programs, mix it with --make and --history
EXAMPLES
Calling the program on the default interactive interface
$ txt2regex
Calling the program on a white terminal
$ xterm -fg black -bg white ; txt2regex --whitebg
Getting information
$ txt2regex --showmeta
Getting specific information
$ txt2regex --showinfo sed
Calling it for specific programs
$ txt2regex --prog vim,sed,grep,python
Applying a history data
$ txt2regex --history '16421x:01x:'
Getting ready regexes!
$ txt2regex --make hour
$ txt2regex --make number3 --prog perl
$ txt2regex --make date2 --all
INTERFACE
The program interface is simple and easy to use. This is its contents:
+---------------------------------------+
| -> Top menu |
| -> Group menu |
| |
| -> Regexes of the programs selected |
| ... |
| ... |
| |
| -> History |
| -> Your prompt |
| |
| -> The question |
| -> The answers |
| ... |
| ... |
+---------------------------------------+
All the basic commands can be used on the numeric pad on the keyboard, but remember to turn ON the NumLock key.
Command Description
. Quit the program (with confirmation)
0 Reset the Regular Expression
1-9 Answers the questions
* Toggles color ON/OFF
/ Add/remove programs on/from the list
| Insert an alternation (where allowed)
( Open a new group (where allowed)
) Close the opened group (if any)
BUGS
Bug reports and contributions are VERY welcome! Please send them to the author.
AUTHOR
Written and maintained by Aurelio Marinho Jargas <verde@aurelio.net>
COPYRIGHT
Copyright (C) 2000, 2001, 2002, 2003, 2004 Aurelio Marinho Jargas
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
September, 28th - 2004 TXT2REGEX(1)