New answers tagged

0

Using xargs, paste, and sed commands: xargs -a <(paste -d'/' fileB fileC) -L1 -I @ sed -i "s/@/g" fileA This will process fileA N times where N is the number of lines in fileB or fileC.


0

Using Raku (formerly known as Perl_6) raku -ne 'print "$_ " if m/^\>/; .print if m/<alpha>$/; .put unless .chars;' Sample Input: >Country1 Aus trali a >Country5 Swi tzer land >Country2 Net herland s Sample Output: >Country1 Australia >Country5 Switzerland >Country2 Netherlands Kudos to @Gilles, who was able to do ...


1

Using Raku (formerly known as Perl_6) raku -pe 's:g/ <[:,]> <(\d+)> /{$/.Num + 10}/;' Sample Input: RS0255_RS0083:115,124,129,141,143,168,170,180 RS0343_RS0083:112,113,163,175,181 RS0343_RS0255:94,101,107,164,179,183 Sample Output: RS0255_RS0083:125,134,139,151,153,178,180,190 RS0343_RS0083:122,123,173,185,191 RS0343_RS0255:104,111,117,174,189,...


0

This solution works but requires a couple of steps and an intermediate file. Step 1: Retrieve a list of IDs for which you want the record removed from file 1: awk -F' ' '{print $1 "\n" $2}' fusions.head16.R2.fastq.tab > remove_list Step 2: Retrieve entries from file 1 that do not contain the IDs from remove_list. awk -F' ' 'NR==FNR{a[$1];next} !...


1

Try to reinstall the package "perl-base". apt-get --reinstall install perl-base


-2

awk '/\$remote_addr/{for(i=1;i<=NF;i++){if($i ~ /\([0-9].*|[0-9].*\)/){print $i}}}' filename|awk -F "(" '{gsub(/\).*/,"",$2);print $2} output 1.2.3.4|5.6.7.8


0

You could also try this sed sed -En '/\$remote_addr/ s/.*\(([0-9.]*\|[0-9.]*)\).*/\1/p' $file It will match any line with $remote_addr then extract the match. The code should be able to match the pattern without explicitly matching $remote_addr beforehand. sed -En 's/.*\(([0-9.]*\|[0-9.]*)\).*/\1/p' $file Output 1.2.3.4|5.6.7.8


3

Since it's a simple substitution on a single line I'd just use sed for that: $ sed -n 's/.*$remote_addr[^(]*(\([^)]*\).*/\1/p' file 1.2.3.4|5.6.7.8 If you really want to use awk though, then you can do this with any awk: $ awk 'sub(/.*\$remote_addr[^(]*\(/,"") && sub(/).*/,"")' file 1.2.3.4|5.6.7.8


1

Considering you want to extract the content of the inner parentheses of the if ($remote_addr ~ ( ... ) ) statement, the following awk program should to: awk 'index($0,"$remote_addr"){sub(/^.*\(/,"");sub(/\).+$/,"");print}' inputfile This will match the line that contains the string $remote_addr. In that line, it will remove ...


1

The ptp script is a Perl script used for opening a file in the Eclipse editor. The script is reproduced and explained in the documentation for something called the Parallel Tools Platform (PTP). See e.g. the Terminal View section: It is possible for the shell and the terminal to interact, allowing the eclipse user to have the best of both the command line ...


Top 50 recent answers are included