Solved

Grep file content into variable while retaining returns in bash

Posted on 2009-03-29
3
1,468 Views
Last Modified: 2013-12-26
I'm using grep on a file and trying to parse the out put into a variable :

value=`grep "value" /file`
echo $vaule

But this returns the content of the file on one line it doesn't respect the returns at the end of each line. How can I fix this?
0
Comment
Question by:TotallyMe
3 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 24015830
You need quotes

echo "$value"
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24015854
can you give example ?
0
 

Author Closing Comment

by:TotallyMe
ID: 31564176
That was easier than expected :)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now