« first day (735 days earlier)   

12:28 AM
1
Q: how to use awk for 'AND' and 'OR' condition together?

SollosaI have 2 column file like: $ cat data a4 b1 a4 c2 a4 b4 z4 c2 I want to match both columns such as if (column1 = a4 and column2 = b1) OR (column1 = a4 and column2 = c2) then the output in column3 should be (DESIRED OUTPUT): a4 b1 matched a4 c2 matched a4 b4 - z4 c2 - so I tried to incorporate m...

 
1:18 AM
2
Q: Does ${@:-1} really return last argument?

PietruI am running the following code when I have two arguments if (( $# == 2 )); then : ${fdir:="${@:-1}"} pfm -w2 "" "unspecified -d option" echo "use last argument as substitute" printf '%s\n\n' "fdir: ${@:-1}" echo "\$1: $1 \$2: $2" This is the result pregion --dyn "John" ./01cuneus pre...

 
 
13 hours later…
1:52 PM
2
Q: How to list the headers of a man page?

Noah MayI want to view a list of the headers in a man page without reading all of the man page. For example, in the bash man page (man bash.1) there are many headers: NAME, SYNOPSIS, COPYRIGHT, DESCRIPTION, etc. In essence, I want a list like the one presented at the top of this HTML man-page. Is there a...

 
 
3 hours later…
4:24 PM
2
Q: Error extracting content after a matching pattern using awk

CheppyI want to use awk to sort content of an input file into different output files. Simple example Assuming the following input file: $cat sample.txt START Unix Linux START Solaris Aix SCO The awk program awk '/START/{x="F"++i;}{print > x}' sample.txt produces the following output ...

 
 
7 hours later…
11:09 PM
2
Q: Dynamically escape a variable

baal_imagoI'm writing a name-helping script to automatically set the "name": field in a package.json file so that it matches a certain regex structure, but I'm having some issues actually setting the name. The regex it must match is '\@abc\/([a-z]+-{0,1})+[a-z]*$'. Right now I do basically this (along with...

 

« first day (735 days earlier)