Find and Replace in UNIX Scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find and Replace in UNIX Scripting
# 1  
Old 01-04-2016
Find and Replace in UNIX Scripting

Hi,

Need your advices,

Input :

Code:
select code,status,input from VIEW1.VIEWNAME where IDU_CD IN ('S','N')  and status_col='derived')) union select code,status,input from VIEW1.VIEWNAME2
where date='#p1'

Expected output :

Code:
select code,status,input from VIEW1.VIEWNAME where IDU_CD IN ('S','N') and IDU_Status="verified" and status_col='derived')) union select code,status,input from VIEW1.VIEWNAME2
where date = '$VAL_FRO_DT'


My attempt :

I am trying to if condition in shell scripting to try to match string but i could not achieved.. could anyone please advice your easy ways.

Regards,
Nantha.Y
Moderator's Comments:
Mod Comment Learning how to use CODE tags is not that hard. This is the 5th time you have been given an infraction for not using CODE tags. Please pay attention to the e-mails you have been getting with these infractions, watch the tutorial included in those e-mails, and start formatting your posts properly instead of depending on the moderators and administrators to clean up your posts for you.

Continued refusal to properly format your posts may result in you losing the ability to post questions in the UNIX and Linux Forums.

Last edited by Don Cragun; 01-04-2016 at 06:53 PM.. Reason: Add CODE tags, again.
# 2  
Old 01-04-2016
not got your requirement exactly. But are you looking for this. ?sed "s/date=\(.*\)/date='\$VAL_FRO_DT'/g" file
# 3  
Old 01-04-2016
Please use code tags as required by forum rules!

In the case at hand, does a script make sense at all? How many query files would it be applied to? Can't and IDU_Status="verified" , being a constant, be inserted into the initial file? And, replacing '#p1' by '$VAL_FRO_DT' could be done in a one off interactive command...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX Scripting help to input string and search a file to find

Hi Don, this is not homework question. I work for a Credit card company and my development goal this year is to learn Unix. I would love if others can help me get started, thanks. Hi everyone I am new to Unix and need help writing a script that can ask user for an input, then search that input... (2 Replies)
Discussion started by: 12ic11
2 Replies

2. Shell Programming and Scripting

UNIX Scripting help to input string and search a file to find

Hi everyone, I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file I know will have to use the read and grep commands, anyone can give me somewhere to start would help Task: Write a script to display which volume pool a given... (1 Reply)
Discussion started by: 12ic11
1 Replies

3. UNIX for Dummies Questions & Answers

UNIX Scripting help to input string and search a file to find

Hi everyone, I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file I know will have to use the read and grep commands, anyone can give me somewhere to start would help Task: Write a script to display... (1 Reply)
Discussion started by: 12ic11
1 Replies

4. Shell Programming and Scripting

Scripting a global find and replace in an VME output print file

Hi Folks, Below is an extract from a VME Print file which gets handed over to a print house. The problem I have is not that tricky rther looking for a way to handle it in a simple and clean way. Is to first select all lines with "0058" which have four spaces so "0058 " as the selcetion... (3 Replies)
Discussion started by: Gary Hay
3 Replies

5. Shell Programming and Scripting

how to find files and replace them in a directory in Shell scripting

I have a directory /java/unix/data In data directory i have so many files from which i want to find some files who look alike below.(there are number of such below such files as well different files too in the data directory) -68395#svg.xml -56789#ghi.xml -67894#gjk.org -56734#gil.txt I... (6 Replies)
Discussion started by: pratima.kumari
6 Replies

6. Shell Programming and Scripting

Need help with scripting (find and replace)

Hello. I've got to files (source and target). 1) target.txt: .... #: tracopt/mimeview/php.py:97 msgid "" ... (1 Reply)
Discussion started by: Naar
1 Replies

7. Homework & Coursework Questions

[Scripting]Find & replace using user input then replacing text after

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: (o) Checkout an auto part: should prompt the user for the name of the auto part and borrower's name: Name:... (2 Replies)
Discussion started by: SlapnutsGT
2 Replies

8. UNIX for Dummies Questions & Answers

Find and replace in all files using shell scripting

Hi all, I'm looking to find and replace a string in all HTML files within a certain directory, including subdirectories. Normally, I would play with this a little to get it to work, but I can't mess this up, so I'm going to ask here. Basically, I want to find "<title>" in all *.htm* files... (11 Replies)
Discussion started by: slothario
11 Replies

9. UNIX for Dummies Questions & Answers

Loop till you find a string in a fine <-- Need Help New to Unix Scripting

Guys - I am new to Unix scripting and am in need for a script that does the following. I have bits and pieces created and tested but i am just having a little difficult time getting it all together. - Loop through till it finds a string in a specific file. Any help is greatly appreciated. ... (1 Reply)
Discussion started by: mrehman
1 Replies

10. UNIX for Advanced & Expert Users

UNIX find by time scripting

Hi, I want to write a UNIX script that checks for any files older then 20mins in in a unix directory. If it does find a file then an email gets sent notifying the administrator. If no files are found then it doesn't do anything. Only thing I'm not so sure about writing is the finding of ... (1 Reply)
Discussion started by: budrito
1 Replies
Login or Register to Ask a Question