Sponsored Content
Full Discussion: Grep -v command
Top Forums UNIX for Beginners Questions & Answers Grep -v command Post 303038778 by RudiC on Friday 13th of September 2019 04:29:45 AM
Old 09-13-2019
Quote:
Originally Posted by Amit Pande
doesnt work
Does:
Code:
grep -v " [01] *[+-]" file
chr10    152763    152818    NB551726:5:H2HT5BGXC:1:11101:11832:4136    21    +
chr10    270718    270779    NB551726:5:H2HT5BGXC:1:21302:6151:20084    36    +
chr10    279976    280049    NB551726:5:H2HT5BGXC:2:13202:7290:18772    42    +
chr10    283222    283281    NB551726:5:H2HT5BGXC:1:11101:10679:13185    22    +
chr10    295639    295667    NB551726:5:H2HT5BGXC:2:23312:6151:17914    22    +
chr10    299560    299613    NB551726:5:H2HT5BGXC:1:23201:2570:5802    36    +
chr10    305259    305319    NB551726:5:H2HT5BGXC:1:11108:11822:9076    36    +
chr10    326693    326754    NB551726:5:H2HT5BGXC:3:12409:12174:3620    36    +
chr10    333356    333417    NB551726:5:H2HT5BGXC:3:11612:14865:1631    36    +
chr10    390585    390649    NB551726:5:H2HT5BGXC:2:21201:17184:1970    41    -
chr10    403073    403135    NB551726:5:H2HT5BGXC:4:22411:12518:10842    36    +
chr10    434880    434942    NB551726:5:H2HT5BGXC:1:11104:1268:15557    21    +
chr10    483038    483100    NB551726:5:H2HT5BGXC:2:22311:25390:20113    11    +
chr10    503546    503580    NB551726:5:H2HT5BGXC:4:13503:22757:1800    22    +
chr10    523026    523082    NB551726:5:H2HT5BGXC:3:12610:14716:4694    44    -
chr10    556875    556935    NB551726:5:H2HT5BGXC:3:11402:15158:12217    36    +
chr10    572659    572731    NB551726:5:H2HT5BGXC:3:23406:8429:3838    42    +
chr10    632605    632666    NB551726:5:H2HT5BGXC:4:21501:15836:16570    36    +
chr10    695526    695596    NB551726:5:H2HT5BGXC:1:13301:7447:12370    42    -
chr10    703974    704036    NB551726:5:H2HT5BGXC:2:11306:16949:4387    12    -
chr10    745719    745782    NB551726:5:H2HT5BGXC:4:22510:13285:17813    41    +

These 2 Users Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep command

What is the meaning of this grep -v $object grant_BU.sql>temp (1 Reply)
Discussion started by: debasis.mishra
1 Replies

2. UNIX for Dummies Questions & Answers

grep command

hi all i have directory /usr under this directory i have subdirectories tmp1,tmp2,tmp3 like this /usr/tmp1 /usr/tmp2 /usr/tmp3 and so on i want to search string in files (i don't know the name of the files)and i want to serch it in all the directories under the /usr how shell i do... (3 Replies)
Discussion started by: naamas03
3 Replies

3. UNIX for Advanced & Expert Users

how to exclude the GREP command from GREP

I am doing "ps -f" to see my process. but I get lines that one of it represents the ps command itself. I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself : I would like to exclude # ps -f UID PID PPID C STIME TTY TIME CMD... (2 Replies)
Discussion started by: yamsin789
2 Replies

4. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

5. Shell Programming and Scripting

Help with using grep command with copy command

Hi, im taking an entry Unix class, and as part of my lab assignment I have to copy all files in the /home/david/lab3 directory that have the file extension .save to your lab3/temp directory. I'm having trouble getting the grep to do anything worth while I've been trying to do: cp... (6 Replies)
Discussion started by: Critical jeff
6 Replies

6. Shell Programming and Scripting

Grep Command

Hi, I have around 500 Text files and Each file will be having either String1 or String2. I want to list the file only which has String1 and Sting2 in a single command.. (5 Replies)
Discussion started by: balasubramani04
5 Replies

7. Shell Programming and Scripting

help on grep command...

Hi I have lots of file in on folder and i want to egrep from only few files. List of files...... Polt_KJ_430_OutputRBS_istUt_CR2.log Polt_KN_4122_OutputRBS_ncChk_CR.log Polt_LN_2230_OutputRNC_Hth_CLKLKL.log Solt_KJ_430_OutputRBS_istUt_CR2.log Solt_KN_4122_OutputRBS_ncChk_CR3.log... (2 Replies)
Discussion started by: asavaliya
2 Replies

8. Shell Programming and Scripting

Grep command

grep -i -f panel_genes.txt hg19_refGene.txt > match.txt seems to be pulling names the do not exist in the input file (panel_genes.txt) - the output is attached as well (match.txt) For example, RNF185 or ZNF146 are not genes in the input. I am trying to match the input file genes only and am... (9 Replies)
Discussion started by: cmccabe
9 Replies

9. Shell Programming and Scripting

Grep command giving different result for different users for same command

Hello, I am running below command as root user #nodetool cfstats tests | grep "Memtable switch count" Memtable switch count: 12 Where as when I try to run same command as another user it gives different result. #su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Discussion started by: Pushpraj
10 Replies

10. UNIX for Beginners Questions & Answers

Help on grep command

for example i have a directory home/solaris/unix/samplefiles/ with defaults files in it.. those default files have 1 word in common "UNIX". how can i list the files without "UNIX" words in it using grep command thanks, im using unix solaris, korn shell.. (1 Reply)
Discussion started by: daveaztig14
1 Replies
SHELL-QUOTE(1p) 					User Contributed Perl Documentation					   SHELL-QUOTE(1p)

NAME
shell-quote - quote arguments for safe use, unmodified in a shell command SYNOPSIS
shell-quote [switch]... arg... DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands or files with embedded white space or shell globbing characters safely. Here are a few examples. EXAMPLES
ssh preserving args When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and passes them to "$SHELL -c". This doesn't work as intended: ssh host touch 'hi there' # fails It creates 2 files, hi and there. Instead, do this: cmd=`shell-quote touch 'hi there'` ssh host "$cmd" This gives you just 1 file, hi there. process find output It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote: eval set -- `find -type f -print0 | xargs -0 shell-quote --` debug shell scripts shell-quote is better than echo for debugging shell scripts. debug() { [ -z "$debug" ] || shell-quote "debug:" "$@" } With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can. save a command for later shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are things the user can't pass through), you can do something like this: user_switches= while [ $# != 0 ] do case x$1 in x--pass-through) [ $# -gt 1 ] || die "need an argument for $1" user_switches="$user_switches "`shell-quote -- "$2"` shift;; # process other switches esac shift done # later eval "shell-quote some-command $user_switches my args" OPTIONS
--debug Turn debugging on. --help Show the usage message and die. --version Show the version number and exit. AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions. AUTHOR
Roderick Schertler <roderick@argon.org> perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)
All times are GMT -4. The time now is 01:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy