Solved

search/replace

Posted on 1998-07-17
8
215 Views
Last Modified: 2010-04-21
I have a bunch of files that all end in
*.sql*
I need to replace all of the ";" with " ".
I have a little script called sr.cgi but it only works one file at a time.  Can anyone tell me a quick command line way to do this?
0
Comment
Question by:asago
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 5

Expert Comment

by:n0thing
ID: 2008845
Do you have perl on your system ??
0
 
LVL 1

Expert Comment

by:mikegrb
ID: 2008846
you should also be able to accomplish what it appears you desire with sed
0
 

Author Comment

by:asago
ID: 2008847
I have access to both.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2008848
What command line are you now using?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Accepted Solution

by:
mikegrb earned 50 total points
ID: 2008849
perl -i -ne 's/;/ /g; print;' *.sql

That should do it... if not let me know of any errors or some such that you get and I will fix it up :)
0
 
LVL 84

Expert Comment

by:ozo
ID: 2008850
 or
perl -i -pe 'tr/;/ /' *.sql*
0
 
LVL 1

Expert Comment

by:mikegrb
ID: 2008851
Yes, tr/// would be faster and I guess print isn't required

. /me consults docs ...

yes print isn't required as ozo the master of all things technologically related has pointed out (note this *IS* a complement meant to be taken positivley :)
0
 

Author Comment

by:asago
ID: 2008852
Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
lsuser for specific number of users listed in a file 11 99
Expiration of TSM data 17 97
Hyper-threading config in Solaris 6 91
cron job says it ran, no results 25 114
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now