Hi All,

Small issue while I am tring to cat the contents of the file .

The script is posted here

myvar=`cat orders.0613`
echo $myvar

The contents of the file orders.0613 contains approximately 200 lines.

but when I do

echo $myvar

the contents are printed in one line.

The newline is characters are stripped off.

I would appreciate any help on this.

Thanks

That's how it works! :)
What do you want to do? To process the file line by line you should directly pipe the output of cat to next command like:

cat orders.0613 | awk ...
cat orders.0613 | sed ...
cat orders.0613 | cut ...

# Of course all of these commands take the input
# file as a param so do not need to do cat.
awk ... orders.0613
cut ... orders.0613
sed ... orders.0613

# or if you have something a bit more complex:
while read oneLine
do
   echo $oneLine
done < orders.0613
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.