1
vote
1answer
2k views

use sed in shell script to replace IP Address in a file

I have a script that finds a string in a file replaces it with a new string. $ sed -i 's/$old_string'/'$new_string'/g' $FILENAME Now I need the condition to be a regular expression that also check ...
1
vote
3answers
224 views

Getting different values of particular variable from a file in UNIX

I have a file which I'd like to parse to extract certain values from it. I don't know what command and syntax I should use (maybe sed?). Below are 2 sample lines which I might expect to find in the ...
2
votes
3answers
4k views

How to get all running process ids only?

I know that ps ax returns the pids 1 ? Ss 0:01 /sbin/init 2 ? S< 0:00 [kthreadd] 3 ? S< 0:00 [migration/0] All I need is to clean those strings, but I ...