#!/bin/bash file=$1 var=$2 cat $file | perl -e 'BEGIN { $var = $ARGV[0] } print ' $var > output