10 More Discussions You Might Find Interesting
1. Solaris
I have a script that needs to read a file with a long list of /path/filenames - replace the name of the server in each file - and write the file to the same path with a date extension. This is the script that I have so far
#!/bin/ksh
umask 022
LIST=`scripts.list`
for i in $LIST
do
... (2 Replies)
Discussion started by: bjdamon
2 Replies
2. Shell Programming and Scripting
The code below gives the string "test1.txt" even though "tessdsdt" does not match "test1.txt". I would like to return "" if there is no match and return some kind of error that I can capture and decide what to do.
echo test1.txt | awk -v src="tessdsdt" -v dst="test" '{sub(src,dst); print}' (16 Replies)
Discussion started by: kristinu
16 Replies
3. UNIX for Dummies Questions & Answers
Hi guys,
say I have a few files in a directory (58 text files or somthing)
each one contains mulitple strings that I wish to replace with other strings
so in these 58 files I'm looking for say the following strings:
JAM (replace with BUTTER)
BREAD (replace with CRACKER)
SCOOP (replace... (19 Replies)
Discussion started by: rich@ardz
19 Replies
4. Shell Programming and Scripting
Input:
>abc|123456|def|EXIT|
>abc|203456|def|EXIT2|
>abc|234056|def|EXIT3|
>abc|340056|def|EXIT4|
>abc|456000|def|EXIT5|
.
.
.
Output:
def|EXIT|
def|EXIT2|
def|EXIT3|
def|EXIT4|
def|EXIT5|
.
.
My try code: (9 Replies)
Discussion started by: patrick87
9 Replies
5. Web Development
Hi everybody,
I was looking at my apache2 log and I found GET requests as such:
Some ip - - "GET... (4 Replies)
Discussion started by: z1dane
4 Replies
6. Shell Programming and Scripting
I am trying to take the two line version of this:
mv myFile.txt myFile.txt.bak
sed 's/foo/bar/g' myFile.txt.bak > myFile.txt
and make it into a shell script with three parameters. First two parameters are the string and string replacement and the third is file. So far this is what I have... (5 Replies)
Discussion started by: gordonheimer
5 Replies
7. Shell Programming and Scripting
Hi all,
Sed is the one which always trobules me :(
here is my input :
*** it industry need to be evolved *** in the world and hope so *** to be dream
the output i am expecting is :
*** it industry need to be evolved
*** in the world and hope so
*** to be dream
... (4 Replies)
Discussion started by: panyam
4 Replies
8. Shell Programming and Scripting
Hi,
I have a line something like this
sys,systematic,system
I want to replace only the word system with HI
I used sed for this as below
echo sys,systematic,system | sed 's/system/HI/'
but I got output as
sys,HIatic,system
I wanted output as
sys,systematic,HI
Please tell me... (9 Replies)
Discussion started by: friendyboy
9 Replies
9. Shell Programming and Scripting
Hi everyone,
Since the previous time I received help from unix.com I have been encouraged to learn more.
going through 1 of the articles(View Article) on sed I found, it pointed an interesting situation.
Suppose the text is :
Romeo and Ethel the Dancer Moves Audience to Tears.
I... (3 Replies)
Discussion started by: hkansal
3 Replies
10. Shell Programming and Scripting
Hi all,
I have a script which uses sed to replace one string with another. The problem is, the string to be matched, and its replacement are coming in as two command line arguments $1 and $2
$1 and $2 can be absolutely anything, but both should be treated purely as strings. My sed command... (7 Replies)
Discussion started by: mark007
7 Replies