On Sun, Sep 18, 2011 at 10:11:17PM -0800, Roger wrote: > > On Mon, Sep 19, 2011 at 01:37:22AM -0400, Mike Frysinger wrote: > >On Monday, September 19, 2011 01:18:02 Roger wrote: > >> I'm stumped on this as my history is in the format of: > >> > >> $ tail ~/.bash_history > >> #1316296633 > >> man bash > >> #1316296664 > >> bash -xv > >> #1316372056 > >> screen -rd > >> #1316375930 > >> exit > >> #1316392889 > >> exit
> >gawk '{ c = $0; getline; if ($1 != "rm") { print c; print; } }' .bash_history > > I don't know gawk (yet), but thinking this isn't going to step-up the one line > from the found 'rm' instance and omit the comment above it. (see above) Why not try running the code before you claim it doesn't work? Here, written out in a more traditional-looking format: gawk ' { c = $0 getline if ($1 != "rm") { print c print } } ' Does that make it easier to read?