New answers tagged

1

grep -l "gold" source.txt will output source.txt if the file contains the word gold xargs sed 's/green/red/' will run sed 's/green/red/' source.txt and the final redirect saves the result in your output. If I understand your intent correctly, you want the following command: sed -n '/gold/s/green/red/p' source.txt > pol.txt The /gold/ selects lines ...


3

To select any line containing gold from source.txt and replace the first occurrence of green with red: $ sed -n '/gold/{s/green/red/; p}' source.txt gold red white black blue To save that in a file: sed -n '/gold/{s/green/red/; p}' source.txt >pol.txt How it works -n tells sed not to print lines unless we explicitly ask it to. /gold/ selects ...


0

1) pls provide more details about problem also look at tr -s "[a-z][A-Z][0-9][:space:]" "[a-z]" because it will lead you to disaster *) [a-z] is wrong if u want get only-lower, correct is a-z *) amount of characters in sets is not equal -> it will repeat last character from set2 so your set2="[abcde...xyz]]]]]]]]]]]]]]]]]]]]]]]]]]..."


2

Try: awk -F "|" '{ a[$5]+=1+length($0) } END{for (name in a) print name,a[name]}' trace.log Example Let's consider this test file: $ cat trace.log 1|2|3|4|jerry|6 a|b|c|d|phil|f 1|2|3|4|jerry|6 The original command produces this output: $ awk -F "|" '{ print $5 }' trace.log | sort | uniq | xargs -l sh -c 'echo -n $0 && grep "$0" trace.log | ...


0

Using GNU sed rather than grep: $ gsed -n '/The following extra packages will be installed:/{:a;n;/Suggested packages:/q;p;ba}' text When the line containing the text The following extra packages will be installed, the sed editing script will create a label called a (to jump back to later) and then read the next line (n). If that line contains the text ...


12

I think it's probably because you're explicitly asking grep to search recursively from /var, and /var/run does not match a SUBDIRECTORY under /var. See grep man page, which states: --exclude-dir=glob [..] skip any subdirectory whose base name matches glob. [..] FIX Therefore, to fix your command, change the exclude pattern, i.e.: sudo grep -IR --...


0

I created a file called playlist containing your string: #EXTINF:-1 tvg-id="ORF1.at" group-title="Deutsch" tvg-logo="0071.png",[COLOR orangered]ORF1 HD[/COLOR] http://62.65.140.214:80/session/a126e0c8-3ffd-11e6-9c3e-005056bc49ac/nvnv5a/1/1010/index.m3u8?token=549d54af4ca436ec0d599cace4ee6bf4_1467513323_1467513323&p=127|X-Forwarded-For=85.195.192.0 #...


0

grep -vf wordlist file_to_be_filtered


0

Have you tried wget --nc? -nc, --no-clobber: skip downloads that would download to existing files. (http://stackoverflow.com/questions/4944295/skip-download-if-files-exist-in-wget)


2

Questions 1 and 3 are related and can be answered at a time. As per the grep man page (emphasis mine): --exclude-dir=DIR Exclude directories matching the pattern DIR from recursive searches. So basically what you specify with that option is a pattern and not a directory itself, meaning /var/www/sometext* or even /var/www/sometext/* will expand and ...


0

To transliterate all uppercase characters in a file to lowercase on a Unix system, use the tr utility like this: $ tr 'A-Z' 'a-z' <inputfile >outputfile


0

If you're getting errors about permissions (you don't say you do), then I'm guessing you're standing in either the root directory (/) or in some path where you don't have permission to read all files, such as in /etc or in /var. But since you say it takes an awfully long time, I'm leaning more towards the first assumption (the root directory). If you want ...



Top 50 recent answers are included