Write a sed script to extract the year, rank, and stock for the most recent 10 years available in the file top10_mktval.csv, and output in the following format:
------------------------------
YEAR |RANK| STOCK
------------------------------
2007 | 1 | Exxon... (1 Reply)
Hello and thx for reading this
I'm using sed to remove only the leading spaces in a file
bash-280R# cat foofile
some text
some text
some text
some text
some text
bash-280R#
bash-280R# sed 's/^ *//' foofile > foofile.use
bash-280R# cat foofile.use
some text
some text
some text... (6 Replies)
i made a script to update a lot of xml files. to save me some time. Ran it and it replaced all the the files with a 0kb file. The problem i was having is that I am using sed to change xml node <doc_root>. The problem with this is it has a / in the closing xml tag and the stuff inside will also have... (4 Replies)
Hi all,
First off, Thank you all for the knowledge I have gleaned from this site!
Deleting Records from a text file... sed paragraphs
The following code works nearly perfect, however each time it is run on the log file it adds a newline at the head of the file, run it 5 times, it'll have 5... (1 Reply)
I'm not sure if the problem I'm seeing is an artifact of sed or simply a beginner's mistake. Here's the problem: I want to add a zero-width space following each underscore between XML tags. For example, if I had the following xml:
<MY_BIG_TAG>This_is_a_test</MY_BIG_TAG>
It should look like... (8 Replies)
My need is :
Want to change
docBase="/something/something/something"
to
docBase="/only/this/path/for/all/files"
I have some (about 250 files)xml files.
In FileOne it contains
<Context path="/PPP" displayName="PPP" docBase="/home/me/documents" reloadable="true" crossContext="true">... (1 Reply)
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
I am learning SED and just following the shell scripting book, i have trouble understanding the grep and sed statement,
Question : 1
__________
/opt/oracle/work/antony>cat teledir.txt
jai sharma 25853670
chanchal singhvi 9831545629
anil aggarwal 9830263298
shyam saksena 23217847
lalit... (7 Replies)
Discussion started by: Antony Ankrose
7 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)