Email: bknpk@hotmail.com Phone: +972-54-7649119


V

 

ASIC/FPGA Design and Verification Out Source Services

This page shows how to change the default bash internal field space separator.

  1. I needed to start a script with a single parameter. The parameter is stored in a file. Each line in the input file, is a single parameter.

  2. The file looks like this:

    -rw-r--r-- 1 pini pini 5186 May 23 20:57 tlc_tb.vhd
    -rw-r--r-- 1 pini pini 3001 May 23 20:57 tlc.vhd
    -rw-r--r-- 1 pini pini 22 May 23 21:32 a.do
    -rw-r--r-- 1 pini pini 670 May 23 21:32 a.vcd
    -rw-r--r-- 1 pini pini 208 May 23 21:33 a.sav
    -rw-r--r-- 1 pini pini 1276 May 23 21:34 simili.lst
    -rw-r--r-- 1 pini pini 142 May 23 21:34 readme.txt

  3. To my surprise, when using for f loop, it invoked the script with each word, separated by spaces, in every line. Since I wanted each line to be a single parameter, to the script, I needed to change the default IFS of bash.

  4. This can be done by:

    #change the default.
    OIFS="$IFS"
    IFS=$'\n'

    for f in `cat 1`; do echo "$f"; done

    #returns to default
    IFS="$OIFS"


  ...


Home

How to extract one version back from svn on given file list.

How to recursively do a svn log on all files.


Download Area






Search This Site


Feedback This Site




new pages on this site