Sponsored Content
Top Forums Shell Programming and Scripting Multiple Substitutions across Multiple Files Post 302761275 by elixir_sinari on Friday 25th of January 2013 11:27:37 AM
Old 01-25-2013
Code:
perl -i.bak -pe 's/this/that/g' <list of file names>

Remove the .bak files after verifying that the substitutions have been done properly.

Note : This will change the inode numbers of all the files.
This User Gave Thanks to elixir_sinari For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Sed to perform multiple substitutions?

Hello I have the following output which is returned with the Month in text format instead of numerical. The output I receive is performed by using Rational Synergy CM software commands from the Unix command line and piping Unix commands on the end. bash-3.00$ ccm query -n... (4 Replies)
Discussion started by: Glyn_Mo
4 Replies

2. UNIX for Dummies Questions & Answers

best method of replacing multiple strings in multiple files - sed or awk? most simple preferred :)

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

3. UNIX for Dummies Questions & Answers

Using AWK: Extract data from multiple files and output to multiple new files

Hi, I'd like to process multiple files. For example: file1.txt file2.txt file3.txt Each file contains several lines of data. I want to extract a piece of data and output it to a new file. file1.txt ----> newfile1.txt file2.txt ----> newfile2.txt file3.txt ----> newfile3.txt Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies

4. Shell Programming and Scripting

Multiple variable substitutions

Is there anyway to accomplish this? (ksh) FILES_TO_PROCESS='NAME1 NAME2' SOURCE_NAME1=/tmp/myfile TARGET_NAME1=/somewhere/else # other file names for i in $FILES_TO_PROCESS do file1=SOURCE_$i file2=TARGET_$i echo cp ${$file1} ${$file2} <-- how do get this to work. done (2 Replies)
Discussion started by: koondog
2 Replies

5. Programming

Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine. So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files. My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies

6. Shell Programming and Scripting

Create Multiple UNIX Files for Multiple SQL Rows output

Dear All, I am trying to write a Unix Script which fires a sql query. The output of the sql query gives multiple rows. Each row should be saved in a separate Unix File. The number of rows of sql output can be variable. I am able save all the rows in one file but in separate files. Any... (14 Replies)
Discussion started by: Rahul_Bhasin
14 Replies

7. UNIX for Dummies Questions & Answers

Multiple substitutions in one expression using sed

Hi, I'm trying to get multiple substitutions in one expression using sed: echo "-foo-_-bar--foo-_bar_-_foo_bar_-foo_-_bar_-" | sed -e "s//-/g" So, as you can see I'm trying to replace all instances of _-, -_, -- with - (dash) I have provided bad example. The question is how to use multiple... (6 Replies)
Discussion started by: useretail
6 Replies

8. Shell Programming and Scripting

Removing carriage returns from multiple lines in multiple files of different number of columns

Hello Gurus, I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file. 1|ABC DEF|100|10 2|PQ RS T|200|20 3| UVWXYZ|300|30 4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies

9. Shell Programming and Scripting

sed parser behaving strange on replacing multiple words in multiple files

I have 4000 files like $cat clus_grp_seq10_g.phy 18 1002 anig_OJJ65951_1 ATGGTTTCGCAGCGTGATAGAGAATTGTTTAGGGATGATATTCGCTCGCGAGGAACGAAGCTCAATGCTGCCGAGCGCGAGAGTCTGCTAAGGCCATATCTGCCAGATCCGTCTGACCTTCCACGCAGGCCACTTCAGCGGCGCAAGAAGGTTCCTCG aver_OOF92921_1 ... (1 Reply)
Discussion started by: sammy777888
1 Replies

10. UNIX for Beginners Questions & Answers

Export Oracle multiple tables to multiple csv files using UNIX shell scripting

Hello All, just wanted to export multiple tables from oracle sql using unix shell script to csv file and the below code is exporting only the first table. Can you please suggest why? or any better idea? export FILE="/abc/autom/file/geo_JOB.csv" Export= `sqlplus -s dev01/password@dEV3... (16 Replies)
Discussion started by: Hope
16 Replies
BOS_PRUNE(8)						       AFS Command Reference						      BOS_PRUNE(8)

NAME
bos_prune - Removes obsolete files from /usr/lib/openafs and /var/log/openafs SYNOPSIS
bos prune -server <machine name> [-bak] [-old] [-core] [-all] [-cell <cell name>] [-noauth] [-localauth] [-help] bos p -s <machine name> [-b] [-o] [-co] [-a] [-ce <cell name>] [-n] [-l] [-h] DESCRIPTION
The bos prune command removes files from the local disk of the server machine named by the -server argument, as specified by one or more of the following flags provided on the command line: o The -bak flag removes all files from the /usr/lib/openafs directory that have a ".BAK" extension. o The -old flag removes all files from the /usr/lib/openafs directory that have a ".OLD" extension. o The -core flag removes all files from the /var/log/openafs directory that have a "core." prefix. o The -all flag removes all three types of files at once. (If none of these flags are included, the command appears to succeed, but removes no files at all.) To display the timestamp on the current, ".BAK", and ".OLD" versions of one or more files, use the bos getdate command. OPTIONS
-server <machine name> Indicates the server machine from which to remove files. Identify the machine by IP address or its host name (either fully-qualified or abbreviated unambiguously). For details, see bos(8). -bak Removes all files from the /usr/lib/openafs directory that have a ".BAK" extension. Do not combine this flag and the -all flag. -old Removes all files from the /usr/lib/openafs directory that have a ".OLD" extension. Do not combine this flag and the -all flag. -core Removes all files from the /var/log/openafs directory that have a "core." prefix. Do not combine this flag and the -all flag. -all Combines the effect of the -bak, -old, and -core flags. Do not combine this flag with any of those three. -cell <cell name> Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see bos(8). -noauth Assigns the unprivileged identity "anonymous" to the issuer. Do not combine this flag with the -localauth flag. For more details, see bos(8). -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The bos command interpreter presents the ticket to the BOS Server during mutual authentication. Do not combine this flag with the -cell or -noauth options. For more details, see bos(8). -help Prints the online help for this command. All other valid options are ignored. EXAMPLES
The following example removes all files from the /usr/lib/openafs directory on the machine "fs3.abc.com" that have a ".BAK" or ".OLD" extension. % bos prune -server fs3.abc.com -bak -old The following example removes all files from the /usr/lib/openafs directory on the machine "db2.abc.com" that have a ".BAK" or ".OLD" extension, and all files from the /var/log/openafs directory that have a "core." prefix. % bos prune -server db2.abc.com -all PRIVILEGE REQUIRED
The issuer must be listed in the /etc/openafs/server/UserList file on the machine named by the -server argument, or must be logged onto a server machine as the local superuser "root" if the -localauth flag is included. The bos prune command cannot be run against servers which are in restricted mode. SEE ALSO
KeyFile(5), UserList(5), bos(8), bos_getdate(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 BOS_PRUNE(8)
All times are GMT -4. The time now is 11:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy