Hi all,
I am writing a script that requires the simple functionality of reading lines from a text file...and writing several of these to a new file..
The lines I want to write to the new file contain tabs and I have not been able to write these lines.
Here is my loop that simply reads every line from the input file and writes it out. The file size is the same but the tabs dissappear.
#!/bin/bash
start=1
rm copied.txt
while true
do
lines=`wc -l $1 |awk '{print $1}'`
if [ $start -le $lines ]
then
grep -e `head -$start $1 | tail -1` >> copied.txt
start=`expr $start + 1`
else
break
fi
done
Any help would be great. I am confused as to where my tabs are going :(
Mark