Skip to main content

All Questions

2 votes
1 answer
180 views

awking for command options from man page

I am trying to auto-generate tab-completions for different commands. I am piping man pages for different commands into awk, then searching for command line options (eg. -shortopt --long-option) ...
myc3lium's user avatar
1 vote
3 answers
205 views

how to filter inner quotes? [closed]

is it possible to filter, i.e to put ESC in front of the inner quotes with sed, awk or other *NIX tool (no perl/python)? Example (revised): $ echo label=\"123 \"456\" 789\" \"AB C\" e f gh | magic-...
ivand58's user avatar
  • 125
3 votes
2 answers
4k views

Define a variable to awk pattern matching from bash

I am trying to grab 100 lines after the text "time: X" with X in {0,40,80,...,200}. Here is what I have so far: #!/bin/bash start=1 end=5 for i in $(seq $start $end);do j=$(($i*40)) awk '/time: ...
user164723's user avatar
3 votes
3 answers
703 views

Why awk understand FS="*" but not for FS="-*-"?

I got a test file, its content is: a -*- b I used awk 'BEGIN {FS="*"} {print $2}' test, it prints out - b Correct! But when I use awk 'BEGIN {FS="-*-"} {print $2}' test, I got: * I know that FS ...
ZengJuchen's user avatar
  • 7,677