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)
Hi,
I know how to use awk to search some expressions like five consecutive numbers, , this is easy.
However, how do I make awk print the pattern that is been matched?
For example:
input: usa,canada99292,japan222,france59664,egypt223
output:99292,59664 (6 Replies)
Hi All,
I am trying to alter all lines between EXEC SQL and END-EXEC that have an INCLUDE in them.
The following code
search="INCLUDE "
cp -f ${WORK}/$file.in ${WORK}/$file.wrk2
for item in `echo $search `; do
> ${WORK}/$file.wrk1
awk -vITEM="$item" '{
if ( $0... (3 Replies)
Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match.
I'm stuck in an AWK... (9 Replies)
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
I am trying to combine lines with these conditions:
1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text.
2. If condition1 is met then continue to combine lines through a line that ends with a semicolon.
3. Ignore case when matching patterns and remove any... (5 Replies)
Hi
I am using Solaris 5.10 & ksh
Wanted to loop through a pattern file by reading it and passing it to the awk to match that value present in column 1 of rawdata.txt , if so print column 1 & 2 in to Avlblpatterns.txt. Using the following code but it seems some mistakes and it is running for... (2 Replies)
I have this fileA
TEST FILE ABC
this file contains ABC;
TEST FILE DGHT this file contains DGHT;
TEST FILE 123
this file contains ABC,
this file contains DEF,
this file contains XYZ,
this file contains KLM
;
I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies
LEARN ABOUT DEBIAN
cg
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)