Use grep to match on the beginning of a line

Just a simple one but a syntax that I can never remember when I need to so a quick post may help jog mine, and your, memory.  This grep syntax is for matching lines from a text file that begin with a particular word or expression :

$ grep -w '^Word' input_file.txt > output_file.txt
This will search input_file.txt for lines that begin with 'Word' and then redirect the output…

Returning an SQL result to a Shell script

Often it can be useful to return the result of a simple SQL*Plus query to a shell script variable, for example to check for a value before deciding wether or not to proceed. The syntax is actually pretty simple :

Removing £ signs from a file using sed

If you've ever tried to use 'sed' to remove the UK pound sign (£) from a file you may have struggled. We were bashing our head against the wall until we tried this little trick :

Converting tab delimited data to CSV data

Here's a little trick we discovered for converting tab delimited text to comma separated (CSV). You'll need access to a Unix, Linux or Mac OS X machine as it relies on the 'tr' command line not present on Windows.

Using the & (ampersand) character in Oracle SQL*Plus scripts

It can be very frustrating when using Oracle SQL*PLus (sqlplus) to run a SQL script that contains an ampersand (&) character only to have the script stop mid-way through and ask you for a value :


  • oracle (8)
  • Mac OS (6)
  • Oracle (6)
  • SQL (5)
  • apex (4)
  • mac os (3)
  • iPhone (3)
  • script (2)
  • GIS (2)
  • map (2)