Script replacing * with name of file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script replacing * with name of file
# 1  
Old 11-18-2011
Tools Script replacing * with name of file

Hi Guys,

I am new to bash and I can't figure this one out.

OS: SunOS

I have a file: myfile

A cat of myfile shows it to contain:

one * two

The shell is as following:

FILE="path/myfile"

RESULT=$(cat "$FILE"|grep one)

echo $RESULT

The output is:

one myfile two

There's the problem. I don't want it to place the word myfile in the output. I would like it to show the exact contents of myfile - one * two.

Any ideas?

Thank you all!!
# 2  
Old 11-18-2011
Code:
echo "$RESULT"

?
This User Gave Thanks to bartus11 For This Post:
# 3  
Old 11-18-2011
That Worked!

Thank you, bartus11! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing 12 columns of one file by second file based on mapping in third file

i have a real data prod file with 80+ fields containing 1k -2k records. i have to extract say 12 columns out of this which are sensitive fields along with one primary key say SEQ_ID (like DOB,account no, name, SEQ_ID, govtid etc) in a lookup file. i have to replace these sensitive fields in... (11 Replies)
Discussion started by: megh12
11 Replies

2. UNIX for Advanced & Expert Users

Creating the script for updating or replacing the existing http.conf file

Hi I need some help with a task, i am an absolute newbie to any form of shell scripting and request guidance. I have been building a proxy server using the apache mod proxy currently my solution is working , but i need to automate the process , suppose if any changes need to be made on... (0 Replies)
Discussion started by: satej
0 Replies

3. Shell Programming and Scripting

sed -Replacing file path within .txt file

Hi, I am trying to use sed to replace a file path within all the .lay (.txt) files in a folder. I feel that this should be easy but I can't get it to work no matter what i try. I'm using cygwin. For a .txt file containing the below line I want to replace this file path with a new one. ... (1 Reply)
Discussion started by: carlr
1 Replies

4. Shell Programming and Scripting

Replacing the ipaddress using script

Hi all , I have written the script but the ip address is not getting replaced correct me i ima wrong #!/bin/bash echo "enetr ip" read $a echo $a b=`grep -o '\{1,3\}\.\{1,3\}\.\{1,3\}\.\{1,3\}' /usr/local/kalyan/mysqlup.sh` echo "$b" sed -i 's/'$b'/'$a'/g' /usr/local/kalyan/mysqlup.sh ... (1 Reply)
Discussion started by: kalyankalyan
1 Replies

5. Shell Programming and Scripting

sed command for copying the contents of other file replacing it another file on specifc pattern

We have 2 file XML files - FILE1.XML and FILE2.xml - we need copy the contents of FILE1.XML and replace in FILE2.xml pattern "<assignedAttributeList></assignedAttributeList>" FILE1.XML 1. <itemList> 2. <item type="Manufactured"> 3. <resourceCode>431048</resourceCode> 4. ... (0 Replies)
Discussion started by: balrajg
0 Replies

6. UNIX for Dummies Questions & Answers

Script for replacing text in a file based on list

Hi All, I am fairly new to the world of Unix, and I am looking for a way to replace a line of text in a file with a delimited array of values. I have an aliases file that is currently in use on our mail server that we are migrating off of. Until the migration is complete, the server must stay... (8 Replies)
Discussion started by: phoenixjc
8 Replies

7. Shell Programming and Scripting

problem with replacing using script

Hi, I'm using MKS tool kit to execute a unix script on windows.I'm trying to replace a word in a file. I'm using sed 's/word/$replaceword/g' $OutputFile This is not working.Please advice where i'm wrong. thanks (4 Replies)
Discussion started by: ammu
4 Replies

8. Shell Programming and Scripting

replacing a script while running

Hi there, How can I run a script being sure that it runs all the way to the end even if the source file is deleted or replaced while running? Actually, I have a script that runs daily on several servers. It replaces local files by updates from a master server. But I'd like it to replace itself... (3 Replies)
Discussion started by: chebarbudo
3 Replies
Login or Register to Ask a Question