Reputation
7,654
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
20 48
Newest
 Yearling
Impact
~638k people reached

Dec
9
comment Print a line only if the next line does NOT contain a particular match
@Wildcard: You are right, but after reviewing the OP's question and the grep like output he is after, it is more appropriate to remember the whole line and output that at the end.
Dec
6
comment Is there a simple command for outputting tab-delimited columns in bash?
@bodacydo: I have added an excerpt from my column manual, that describes the -t flag. The foo on the command line is the input file, if it is omitted, standard in will be used instead. In order to determine correct column widths, column will buffer the whole input before returning the result.
Dec
2
comment Output part of each line to a separate file
That is much better. I get a 2 times speedup with this version: yes ATGC | fold -w1 | head -n6400000 | shuf | tr -d \\n | fold -w64.
Dec
2
comment Output part of each line to a separate file
I think the generation speed of your test harness is bound by the random number generator. You can make it faster by using every number it gives or generate an homogeneous distribution, e.g.: paste <(yes A) <(yes T) <(yes G) <(yes C) | head -n1600000 | tr '\t' '\n' | shuf | tr -d \\n | fold -w64 | cat -n > infile.
Sep
16
comment Split a set of data to massives and find maximum for each
Surely the first output line should be: 2 0.23?
Sep
9
comment head, tail, and then line?
Related question: stackoverflow.com/q/12182910/1331399
Sep
9
comment Find text between tab (\t) as a delimiter
@tachomi: You could also use the double-quotes as the delimiter. See my answer.
Sep
8
comment Find text between tab (\t) as a delimiter
@tachomi: Glad it worked, added two awk alternatives.
Sep
8
comment Find text between tab (\t) as a delimiter
Use awk -F '\t' ....
Sep
8
comment How to print own script name in mawk?
@fedorqui: no worries, you also quoted the relevant manual bits and showed an alternative use of ps.
Sep
8
comment How to print own script name in mawk?
@cipper: You can get the process id through a sub-shell in mawk. See the edit.
Sep
7
comment How to print own script name in mawk?
@cipper: then use the answer by cuonglm.
Sep
7
comment How to print own script name in mawk?
@cipper: The PROCINFO hash is GNU awk specific, so this only works with GNU awk.
Sep
7
comment How to print own script name in mawk?
@cipper: This only works with GNU awk, I added the missing shebang line.
Aug
20
comment Merging columns in a file using Awk
@glennjackman: You're right, I made an edit with a warning. Thanks.
Jul
11
comment How can I split a text file into multiple text files?
@ghoti: Right, I should have mentioned that. I have included that in the answer now. Thanks.
Mar
23
comment How to sort the string which combined with string + numeric using bash script?
@ErnestA: You are right, this is GNU sort specific solution. Added a note.
Nov
13
comment Output part of each line to a separate file
@StéphaneChazelas: I see, and it has been there for a while. I did not know about this, thanks for telling me.
Nov
13
comment Output part of each line to a separate file
@glennjackman: This was just an interesting alternative way of doing it. If the input is large, awk is probably the most efficient tool to use. You are of course right about not spawning sh for each line, I have added the pipe-option as an alternative.
Nov
13
comment Output part of each line to a separate file
If there are many lines, all available file descriptors will be used, so you should probably add a close($1".seq").