File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
Linux / UNIX
echo with grep
Joined: Oct 03, 2008
Jun 22, 2009 09:09:28
I have something like below, the result of the grep is assigned to abcd variable
abcd=`grep -n "^AB.*123456.*" /tmp/file | cut -d: -f1`
when I try to echo this result to a file using echo $abcd>> /tmp/abc it is not working
It works when I run from the command prompt and this gets assigned to abcd but when I try to print the value using echo $abcd i dont get any results..
Joined: Oct 01, 2001
Jun 24, 2009 00:22:37
It seems to work for me. What shell are you using? Bash, Bourne shell, Korn shell? Does the file /tmp/abc exist already before you run the echo command? Is NOCLOBBER set?
Can you echo anything into the file? For example: echo text >> /tmp/abc Does that work?
I agree. Here's the link:
subject: echo with grep
Mutable Property in Ant Script
Running JBoss-5.1.0.GA as a service on Red Hat?
JBOSS is not working
XML document create with Java
echo not working with grep
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014