Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 44072

A pattern-directed scanning and processing language.

2
votes
We're at it again slm :) Similar mechanism in perl, from the command line: perl -ane 'print "$F[0] $F[1]\n $F[3] $F[2] @F[4..9]\n" . " $F[11] $F[10] @F[12..17]\n"' inputf …
answered Sep 2 '13 by Drav Sloan
2
votes
perl -ane 'print if($F[3] =~ /^\w,\w/$);' file -n tells perl to process the infile one line at a time passing each line to the commands specified in -e. The -a tells perl to expand each line around …
answered Sep 11 '13 by Drav Sloan
2
votes
With perl inside a perl script (processing STDIN) while(<>) { if(/^([^:]+):.*{{IPA\|([^}]+)}}/) { print "$1 $_\n" foreach(split /\|/, $2); } } or on the command line (piping) per …
answered Aug 6 '13 by Drav Sloan
6
votes
Simply: sed 'n;d' file for even lines, and sed '1!n;d' file for odd lines. With the GNU implementation of sed, you can also use this syntax: Odd: sed '1~2d' file Even: sed '2~2d' file
answered Jul 29 '13 by Drav Sloan
0
votes
grep /var/log /etc/rsyslog.conf | awk '{print $2}' | sed 's/^-//' sed will look for the start of a line s/^ followed by a hyphen - and replace it with an empty string //. …
answered Dec 14 '15 by Drav Sloan
25
votes
grep will most likely be faster: # time awk '/USAGE/' imapd.log.1 | wc -l 73832 real 0m2.756s user 0m2.740s sys 0m0.020s # time grep 'USAGE' imapd.log.1 | wc -l 73832 real 0m0.110s … user 0m0.100s sys 0m0.030s awk is a interpreted programming language, where as grep is a compiled c-code program (which is additionally optimized towards finding patterns in files). (Note - I …
answered Aug 28 '13 by Drav Sloan
11
votes
I would change a few things about. find_code() { # assign all arguments (not just the first ${1}) to MATCH # so find_code can be used with multiple arguments: # find_code errorCode …
answered Aug 9 '13 by Drav Sloan