Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.
Substring after =
Name: bvsbabu Date: September 26, 2006 at 08:07:16 Pacific OS: KSH CPU/Ram: ksh Product: AIX
Comment:
Hi,
I have a string called name1=value1. I am struggling to write a awk/script to get the "value1" into some variable. Could some one help me... plzzzzz
You can use the ksh pattern matching operators to do the same thing:
var="name1=value1" x=${var#*=} echo $x
In the above example, anything and an equal sign is deleted from the string.
0
Response Number 2
Name: bvsbabu Date: September 26, 2006 at 09:01:12 Pacific
Reply:
Thank you very much for your help.. it helped me very much.
I have extension of this problem, I need to search in a file config.xml for <user>scott</user> and replace the value "scott" with different value "xyz". The final output of the config.xml is <user>xyz</user>
Is there any way to search and replace in the config.xml without renaming it.
0
Response Number 3
Name: nails Date: September 26, 2006 at 12:58:01 Pacific
Reply:
When using the traditional unix tools such as awk, sed, tr, etc. you have no option but to rename the file after processing finishes.
I'm not much of a perl programmer, but I know that perl has an option that allows editing a file without renaming it.
Perhaps some of the other modern scripting languages like php and ruby do the same?
Summary: All, I have extracted some data using awk substr function. myvar = substr ($0,300,5) Then I want to test this myvar whether it is equal to 000. I tried if [ myvar = 000] then print xxx fi. It didn't ...
Summary: Jern, I used awk because it is much more appropriate for a task such as this. At startup, the BEGIN statement sets the Output Field Separator to the tab character to tell the print statement how to de...
Summary: Hi Need some help here with ftp I am ftping a .TAR file of huge size on different server...the tar file ftp'ed does not have permission for others to untar it.... even though the file i am ftping h...