08-01-2012
Quote:
Originally Posted by
evrurs
@Vryali,
Thanks a lot and the code worked fine. However, Is it possible to insert the text in a Alphabetical Order instead of inserting it in the Last line.
Data samples are worth a thousand words. Show us the code you used and how you invoked it. Show us the input you fed to that code. Show us the actual output of that code. Show us the desired output for that input. If there is anything that isn't obvious, then please explain further.
Explanations are helpful -- they help us digest the data samples faster -- but they are no substitute for demonstrative data.
Regards,
Alister
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file with
aaa,bbb,ccc,dddd,eee,xyz
aaa,bbb,ccc,dddd,eee,xyz,12345,rty
aaa,bbb,ccc,dddd,eee,xyz,12345,rty,tsrt
1. line columns are not fixed
2. all words are seperated by comma
what i want is always the string after last comma.
regards,
Senthil... (9 Replies)
Discussion started by: senthilk615
9 Replies
2. Shell Programming and Scripting
Hi Friends.
Please have a look at dummy file. I need to extract from this file:
1. Counts of event=
2. the 2nd coulmn is unique call id of this transaction. Based on that, i have to search for txstatus= .
Note: Values of event, calltype and txstatus can be anything.
I want to print... (1 Reply)
Discussion started by: itsmesanju
1 Replies
3. Shell Programming and Scripting
hi all,
I am trying to do search on a gzip file. The file has
<pattern1>
Data..
<pattern2>
data
<pattern1>
data
<patter2>
I want to print each pattern 1 and the corrresponding pattern2. If pattern 2 fails to appear and pattern 1 appears, I do not want to print pattern1 and... (3 Replies)
Discussion started by: baskar123
3 Replies
4. Shell Programming and Scripting
Hi ,
I am having an issue with the Awk script to insert newline for a regular expression match
Having a file like this
FILE1
####################
RXOER , RXERA , RXERC , RXERD
.RXEA(RXBSN), RXERD , REXCD
input RXEGT
buffer RXETRY
#######################
Want to match the RXE... (38 Replies)
Discussion started by: jaita
38 Replies
5. Shell Programming and Scripting
Hi,
I use sed to insert text at beginning of a file. But sed inserts a newline after my text that I do not need. For example, I want to insert "foo" at the beginning of my file:
> cat myfile
This is first line.
> sed -i '1i\foo' myfile
> cat myfile
foo
This is first line.
... (5 Replies)
Discussion started by: tdw
5 Replies
6. Shell Programming and Scripting
I would like to print result of multiple search pattern invoked from an one liner. The code looks like this but won't work
gawk -F '{{if ($0 ~ /pattern1/) pat1=$1 && if ($0 ~ /pattern2/) pat2=$2} ; print pat1, pat2}'
Can anybody help getting the right code? (10 Replies)
Discussion started by: sdf
10 Replies
7. Shell Programming and Scripting
Need to
1. archive all the files in a directory from the previous month into a tar/gz file, ignoring all already archived 'tar.gz' files
2. Check created .tar.gz file isnt corrupted and has all the required files in it. and then remove the original files.
I am using a function to get the... (1 Reply)
Discussion started by: Prev
1 Replies
8. Shell Programming and Scripting
Hi,
I am trying to find a way to get sed/awk/grep to help me find a string in a log file that exists between two datestamps and then print the preceding datestamp up to the next datestamp.
Here is an example of my logfile:
+++ 2013/03/28 17:01:37.085 SIGNALING HIGH ACTIVE
Failure Response... (5 Replies)
Discussion started by: raytx
5 Replies
9. Shell Programming and Scripting
Hi ,
I have a huge file with following records and I want to replace the last comma with ',NULL'. I try using SED but could not create a correct script .
In my opinion I need a script which can convert ,/n with ,NULL/n
1,CHANGE_MEMBER,2010-12-28 00:05:00,
2,CHANGE_MEMBER,2012-09-02... (8 Replies)
Discussion started by: Ajaypal
8 Replies
10. Shell Programming and Scripting
I want to bring values in the second column into single line for uniq value in the first column.
My input
jvm01, Web 2.0 Feature Pack Library
jvm01, IBM WebSphere JAX-RS
jvm01, Custom01 Shared Library
jvm02, Web 2.0 Feature Pack Library
jvm02, IBM WebSphere JAX-RS
jvm03, Web 2.0 Feature... (10 Replies)
Discussion started by: kchinnam
10 Replies
CG(1) CG(1)
NAME
cg - Recursively grep for a pattern and store it.
SYNOPSIS
cg [ -l ] | [ [ -i ] pattern [ files ] ]
DESCRIPTION
cg does a search though text files (usually source code) recursively for a pattern, storing matches and displaying the output in a human-
readable fashion. It is intended to give some of the functionaly of AT&T's cscope(1) tool, with the advantages of simplicity and not being
language-specific. The script will colorize output if configured as such.
It is typically run with a Perl regular expression to search for. The search can be made case insensitive by using the -i option. A list
of files may also be specified with an additional argument after the pattern. Put the files pattern in quotes to make it be matched by
Perl rather than by the shell. Running the script with no arguments will recall the results of the previous search. After the search,
entries found can be edited using the vg(1) script. The -l option shows the last log made.
SOME EXAMPLES
cg - alone recalls the previous search results.
cg -i pattern - search the default list of files for all files matching the pattern (and case-insensitively).
cg pattern '*.c' - search recursively for pattern in all *.c files. This automatically converts '*' to '.*' and '.' to '.' for you and
does a Perl pattern match on all files in the tree.
cg pattern *.c - search through the shell-expanded list of *.c files, so not done recursively (in other words, only the files your shell
pass to the script as arguments).
cg -l - show the last log made.
COMMAND-LINE OPTIONS
-i Do a case-insensitive search.
-l Show the last log made.
-p Toggle the default pager option. cg has a bulit-in pager function, which can be enabled or disabled by default (in .cgvgrc). If the
default is enabled, this option disables the pager; if the default is disabled, this option enables it.
-P Force the built-in pager to be disabled.
FILES
${HOME}/.cglast
Log file of the last search.
${HOME}/.cgvgrc
Per-user configuration file (if the defaults are not desireable).
${HOME}/.cgvg/*
Log files in $HOSTNAME.shell_pid form with the log of the last search.
SEE ALSO
vg(1), perl(1), find(1), grep(1), cscope(1)
AUTHOR
cg was written by Joshua Uziel <uzi@uzix.org>.
13 Mar 2002 CG(1)