04-29-2008
exclude multiple records
Hi
I need to exclude multiple records in file .Using grep -v ,can exclude that record
Ex: If want to exclude 0012777201,0012777202
use grep two times .Is there any command to achive this through single command ?( cann't use grep multiple times if need to exclude multiple records in husge file)
grep -v 0012777201 a.txt >a1.txt
grep -v 0012777202 a1.txt >a2.txt
a.txt
====
20080331|2505|0012777201|1|U|U|U|
20080331|2505|0012777202|1|U|U|U|
20080331|2505|0012777204|1|U|U|U|
20080331|2505|0012777205|1|U|U|U|
20080331|2505|0012777206|1|U|U|U|
Thanks,
MR
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
can I do something like this to add a condition of checking if the 4th field is number or space or blank also:
awk -F, '$4 /^*||*/' MYFILE >> OTHERFILE
I also want the other part i.e. I need to exclude all lines whose 4th field is space or blank or number:
MYFILE
a,b,c,d,e
a,b,c,2,r... (2 Replies)
Discussion started by: praveenK_Dudala
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
Can some one help me how to exclude multiple directories using find command..
I have the directory structure below.
/a/a1/b1
/a/c1/c2
/a/d1/d2/d3
I want to exlcude a1,c2and d3 from the above using find,can some one suggest pls..
thanks in advance...
Use code tags... (1 Reply)
Discussion started by: jagadish_gaddam
1 Replies
3. Shell Programming and Scripting
Hi All,
I have a *.csv files in a die /pro/lif/dow, (pipe delimiter file), these files are having 8 columns and 6 column(CDR_LOGIC) records are populated as below, I need to incorporate the below logic in all the *.csv files.
11||:ColumnA||:ColumnB
123||:ColumnA
IIF(:ColumnA = :ColumnC then... (6 Replies)
Discussion started by: shruthidwh
6 Replies
4. Shell Programming and Scripting
Hi ,
I have the below source
source data
1|2|3|:123:abc|4
1|2|a| | 5
1|2|3|4|:a:s:D.....:n|t
Target data should be
1|2|3|:123:abc|4
1|2|3|:123:abc|4
1|2|a| | 5
1|2|3|4|:a:s:D.....:n|t
1|2|3|4|:a:s:D.....:n|t
1|2|3|4|:a:s:D.....:n|t
1|2|3|4|:a:s:D.....:n|t (3 Replies)
Discussion started by: mora
3 Replies
5. Ubuntu
I am familiar with using tar and exclude/include files:
tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion
but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is... (2 Replies)
Discussion started by: metallica1973
2 Replies
6. Shell Programming and Scripting
Hi All,
I am trying to split a record into multiple records based on a value.
Input.txt
"A",1,0,10
"B",2,0,10,15,20
"C",3,11,14,16,19,21,23
"D",1,0,5
My desired output is:
"A",1,0,10
"B",2,0,10
"B",2,15,20
"C",3,11,14
"C",3,16,19
"C",3,21,23 (4 Replies)
Discussion started by: kmsekhar
4 Replies
7. Shell Programming and Scripting
Hi,
I have 3 tab delimited text files which look like this.
File1:
PROTEINID DESCRIPTION PEPTIDES FRAMES
GB://115298678 _gi_115298678_ref_NP_000055.2_ complement C3 precursor 45 55
GB://4502027 _gi_4502027_ref_NP_000468.1_ serum albumin preproprotein 34 73
Entrez://strain 11128 /... (3 Replies)
Discussion started by: Vavad
3 Replies
8. Shell Programming and Scripting
I need to make one record to multiple records based on occurence column in the record and change the date.For example below first record has 5 ,so need to create 5 records from one and change the date to 5 months.Occurence can be any number.
I am unable to come with a script.Can some one help
... (5 Replies)
Discussion started by: traininfa
5 Replies
9. Shell Programming and Scripting
Hi
I have a txt file and I would like to use egrep without using -v option to exclude the lines which matches with multiple Strings.
Let's say I have some text in the txt file. The command should not fetch lines if they have strings something like
CAT MAT DAT
The command should fetch me... (4 Replies)
Discussion started by: Sathwik
4 Replies
10. Shell Programming and Scripting
Hi,
I'm working on a shell script that reports service status on a database server.
There are some services that are in disabled status that the script should ignore and only check the services that are in Enabled status.
I output the service configuration to a file and use that information to... (5 Replies)
Discussion started by: senthil3d
5 Replies
LEARN ABOUT DEBIAN
pdfgrep
pdfgrep(1) USER COMMANDS pdfgrep(1)
NAME
pdfgrep - search pdf files for a regular expression
SYNOPSIS
pdfgrep [OPTION...] PATTERN FILE...
DESCRIPTION
Search for PATTERN in each FILE. PATTERN is an extended regular expression.
pdfgrep works much like grep, with one distinction: It operates on pages and not on lines.
OPTIONS
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files.
-H, --with-filename
Print the file name for each match. This is the default setting when there is more than one file to search.
-h, --no-filename
Suppress the prefixing of file name on output. This is the default setting when there is only one file to search.
-n, --page-number
Prefix each match with the number of the page where it was found.
-c, --count
Suppress normal output. Instead print the number of matches for each input file. Note that unlike grep, multiple matches on the same
page will be counted individually.
-C, --context NUM
Print at most NUM characters of context around each match. The exact number will vary, because pdfgrep tries to respect word bound-
aries. If NUM is "line", the whole line will be printed. If this option is not set, pdfgrep tries to print lines that are not longer
than the terminal width.
--color WHEN
Surround file names, page numbers and matched text with escape sequences to display them in color on the terminal. (The default set-
ting is auto).
WHEN can be:
always Always use colors, even when stdout is not a terminal.
never Do not use colors.
auto Use colors only when stdout is a terminal.
-R, -r, --recursive
Recursively search all files (restricted by --include and --exclude) under each directory.
--exclude=GLOB
Skip files whose base name matches GLOB. See glob(7) for wildcards you can use. You can use this option multiple times to exclude
more patterns. It takes precedence over --include. Note, that in- and excludes apply only to files found via --recursive and not to
the argument list.
--include=GLOB
Only search files whose base name matches GLOB. See --exclude for details. The default is *.pdf.
--unac Remove accents and ligatures from both the search pattern and the PDF documents. This is useful if you want to search for a word
containing 'ae', but the PDF uses the single character 'ae' instead. See unac(3) and unaccent(1) for details.
[This option is experimental and only available if pdfgrep is compiled with unac support.]
-q, --quiet
Suppress all normal output to stdout. Errors will be printed and the exit codes will be returned (see below).
--help Print a short summary of the options.
-V, --version
Show version information
ENVIRONMENT VARIABLES
The behavior of pdfgrep is affected by the following environment variable.
GREP_COLORS
Specifies the colors and other attributes used to highlight various parts of the output. The syntax and values are like GREP_COLORS
of grep. See grep(1) for more details. Currently only the capabilities mt, ms, mc, fn, ln and se are used by pdfgrep, where mt, ms
and mc have the same effect on pdfgrep.
EXIT STATUS
Normally, the exit status is 0 if at least one match is found, 1 if no match is found and 2 if an error occurred. But if the --quiet or -q
option is used and a match was found, pdfgrep will return 0 regardless of errors.
AUTHOR
Hans-Peter Deifel <hpdeifel at gmx.de>
SEE ALSO
grep(1), regex(7)
version 1.2 February 14, 2012 pdfgrep(1)