-2
votes
2answers
49 views

Trying to count and print song file names using awk

RANK NAME BAND YEAR GENERE DOMESTIC/INTERNATIONAL 206:Reach Out, I'll Be There:The Four Tops:1978:Pop:3/2 207:Bye Bye Love:The Everly Brothers:1950:Classic:3/2 ...
0
votes
2answers
32 views

I want to find out word which ends with ()…Use grep

I want to find out word which ends with ()...Using the grep command in linux. grep file_name_where_i_want_to_search "*()" some thing like that....but its not working
0
votes
2answers
232 views

How to restrict grep to search only below a token of a column?

How can I use grep to search only the values of a column below a token? For example in the following CSV file: A B C 1 𝟒 5 2 𝟒 0 1 𝟑 6 ...how can I get ...
1
vote
2answers
59 views

How to save linux command?

I am using grep -r [^a-zA-Z0-9]myVariableName[^a-zA-Z0-9] -n JS_files/ as mygrep file grep -r [^a-zA-Z0-9]$1[^a-zA-Z0-9] -n JS_files/ and then sh mygrep myVariableName But then I lose the ...
0
votes
2answers
169 views

When I grep no particular file the terminal stops working

I'm learning how to use the shell. In playing around with some basic commands I encountered an issue. This is pretty basic stuff and I apologize if that upsets some folk. On my desktop there exists a ...
0
votes
1answer
366 views

How to grep file with prefix pattern?

How can I grep for lines of a file wich start with a certain string? For example, all lines with prefex 0x, where the file has the lines 0x002 0x003 abc Output should be 0x002 0x003
0
votes
4answers
277 views

Regular expression to find senders IP using grep or other languages

I have input file that contains: 19:04:01.631948 IP (tos 0xc0, ttl 1, id 0, offset 0, flags [none], proto UDP (17), length 48) 181.173.82.61.1985 > 250.66.33.195.1985: HSRPv0-hello 20: ...
0
votes
1answer
984 views

Using find with -exec gzip and grep

I have a bunch of zipped up log files and I want to search them all for a string. I tried this but it's not working: find ./ -name "*.log.zip" -exec gzip -dc {} | grep ERROR \; It's giving me: ...
1
vote
1answer
208 views

Subtract files from one another recursively between two similar directories

I'm trying to concoct a way to grab two (nearly identical) directories and show me the difference between all files in the two directories. Looking for two different things: 1- List all files ...
0
votes
1answer
475 views

Grep issue (match two strings on same line)

Here I have some grep command which is not working correctly: cat file1.txt: apples Date: Sun, 24 Feb 2013 8:14:06 -0800 peaches melons cherry sky cloud green purple yellow cat file2.txt: apples ...
0
votes
6answers
637 views

grep *.c not working

I have a list of ".c" (c files) in the current directory. I have to find all the .c files in the current directory. The command that can be used id ls *.c But, another way is to use grep. so if i ...
1
vote
3answers
3k views

How to grep logfile via SSH on multiple servers?

Sometime, I need to find out specific log content(such as api call) from log files, those log files exists in several Linux servers. I have to use SSH to login every server and use grep searching the ...
0
votes
4answers
144 views

how to do grep in the man command of linux using xargs?

I want to grep into a manual of a particular command say man grep |grep 'insensitive'. One of friends told me that It can be done using xargs but I cant seem figure out how. I want to do it using ...
0
votes
1answer
285 views

How to zgrep by file pattern and timestamp?

I have a list of several thousand gzip (*.gz) files that I'd like to zgrep through, but I only want to run it on files with a last-modified-timestamp on or after yesterday (11/22/2012) and that ...
0
votes
4answers
127 views

how do I use the grep command to match a particular pattern ? if pattern specified in grep is “4” it should not return lines containing 44

When i use the grep command as follows : rollno=4 grep $rollno=4 new.txt it returns the records that contain 44 or 4444 or 24,etc as roll no.How do i eliminate this flaw?
4
votes
4answers
4k views

Print back-reference in regular expression

I was hoping for a way to make sed replace the entire line with the replacement (rather than just the match) so I could do something like this: sed -e "/$some_complex_regex_with_a_backref/\1/" and ...
1
vote
5answers
37 views

Why does the shell perform pathname expansion for utilities?

This question is a sequel of how does grep work? It seems that the shell does the expansion of *.* to all applicable/available files and provide that to utilities like grep. Why does the shell need ...
1
vote
3answers
196 views

How can I determine whether different commands using grep, find and xargs do the same thing?

Do these three commands do the same thing? A command that uses grep. grep "a" -r . A command that uses find. find . -exec grep "a" {} \; A command that uses a grep on a find through xargs. ...
1
vote
4answers
8k views

Search with “grep” for folder names

When using grep you can search for a specific regex, but only inside of a file. Is there any way, I can search for a folder name?
1
vote
3answers
358 views

Find the longest matching prefix in file?

For example, file a.txt: /abc /abc/def /abc/xyz /abcd /fghi Give input and expected results are: /abc/dog => /abc /abc/def12 => /abc/def /dog => (NONE) Is this possible ...
0
votes
8answers
236 views

Unix command to list the portion of the end of a log file from a line containing only hyphens to end of file

I have a long log file where each entry begins with a line containg only hyphens.
10
votes
4answers
5k views

Better way to do “echo $x | sed …” and “echo $x | grep …”

I often find this in scripts (and, I have to admit, write it myself): a=`echo $x | sed "s/foo/bar/"` or if echo $x | grep foo then ... fi Consider "foo" to include some regex stuff. I feel ...