Hi,
I am looking for a way to find a particular word in a file then print a line that precedes this line, as well as this line.
Sometimes in a log file there is only one word per line and I need to print one of the lines leading up to the single worded line.
Example - I can grep for ouch... (5 Replies)
hii,
i want to know the shell command for finding the last occurance of a substring in string..
i can use grep command or sed to find out the occurance of a substring in a string but how do i find out the last occurance.shud i use grep amd and cut the string everytime and store it in a new... (7 Replies)
please give me proper solution for finding a shortest substring from given string if string itself and first char and last char of that substr are also given by user
if S="dpoaoqooroo" and FC="o" and LC="o",then shortest substr is "oo" and rest of the string is "dpoaoqroo"
i have code but it is... (1 Reply)
Hi frndz,
i have a flat file like,
xxx yyy zzz sss aaa bbb yyy xxx rrr sss ttt yyy ddd zzzz cccc..
look, in this file i want to fetch the substring from one yyy to another one and need to print it then from next values between yyy's..
can you please give me some inputs on this..
... (10 Replies)
Hi,
I need to check if a particular name is already in the file or not and i am using following code for this...
match=$(grep -n -e "$output1" outputfiles.txt )
where output1 is the variable name having names in it and outputfiles.txt is the file name ..and i am using ksh
can anybosy... (6 Replies)
I will be performing a task on several directories, each containing a large number of files (2500+) that follow a regular naming convention:
YYYY_MM_DD_XX.foo_bar.A.B.some_different_stuff.EXT
What I would like to do is automatically discover the part of the filenames that are common to all... (1 Reply)
I have million's of records each containing exactly 50 characters and have to check the uniqueness of 4 character substring of 50 character (postion known prior) and report if any duplicates are found.
Eg. data...
AAAA00000000000000XXXX0000 0000000000... upto50 chars... (2 Replies)
Can someone help me to make this code without cutting off words ni the string?
awk '{for(i=1;i<length;i+=100) print substr($0,i,100)}'
Thank you! (4 Replies)
hello.
I get this text when using some command :
S | Name | Type | Version | Arch | Repository
--+-----------------+---------+---------+------+-------------
| AdobeReader_enu | package | 9.5.4-1 | i486 | zypper_local
I need to get "AdobeReader_enu" from the the pattern "Ado"... (7 Replies)
Dear All,
assume that we have a text file or a folder of files,
I want to find this pattern followers*.csv in the text file , and get * as the output.
There are different matches and * means every character.
Thank you in advance.
Best,
David (1 Reply)
Discussion started by: davidfreed
1 Replies
LEARN ABOUT LINUX
gid
GID(1) User Commands GID(1)NAME
gid - Query ID database and report results.
SYNOPSIS
gid [OPTION]... PATTERN...
DESCRIPTION
Query ID database and report results. By default, output consists of multiple lines, each line containing the matched identifier followed
by the list of file names in which it occurs.
-f, --file=FILE
file name of ID database
-i, --ignore-case
match PATTERN case insensitively
-l, --literal
match PATTERN as a literal string
-r, --regexp
match PATTERN as a regular expression
-w, --word
match PATTERN as a delimited word
-s, --substring
match PATTERN as a substring
Note: If PATTERN contains extended regular expression metacharacters, it is interpreted as a regular expression substring. Other-
wise, PATTERN is interpreted as a literal word.
-k, --key=STYLE
STYLE is one of `token', `pattern' or `none'
-R, --result=STYLE
STYLE is one of `filenames', `grep', `edit' or `none'
-S, --separator=STYLE
STYLE is one of `braces', `space' or `newline' and only applies to file names when `--result=filenames'
The above STYLE options control how query results are presented. Defaults are --key=token --result=filenames --separator=space
-F, --frequency=FREQ
find tokens that occur FREQ times, where FREQ is a range expressed as `N..M'. If N is omitted, it defaults to 1, if M is omitted it
defaults to MAX_USHRT
-a, --ambiguous=LEN
find tokens whose names are ambiguous for LEN chars
-x, --hex
only find numbers expressed as hexadecimal
-d, --decimal
only find numbers expressed as decimal
-o, --octal
only find numbers expressed as octal
By default, searches match numbers of any radix.
--help display this help and exit
--version
output version information and exit
REPORTING BUGS
Report bugs to bug-idutils@gnu.org
SEE ALSO
The full documentation for gid is maintained as a Texinfo manual. If the info and gid programs are properly installed at your site, the
command
info gid
should give you access to the complete manual.
gid - 4.5 August 2010 GID(1)