08-27-2009
for file in *; do var=`echo $file | cut -c1-3`; perl -pi -e s/\,C/\,"$var"C/g $file; done
Last edited by cabrao; 08-27-2009 at 05:53 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm writing a shell script and I need to replace the contents of a configuration file based on what is passed to the script...can I replace expressions in a file from a bash shell script? (2 Replies)
Discussion started by: HumanBeanDip
2 Replies
2. Shell Programming and Scripting
Hi,
I have 2 sets of text files. I need to take a field from a certain line in set 1 and put it in the same place in set b. The line appears once per file, in different places but is a set format and has the unique word "ANTENNA" in it and is always 81 characters long. Example from set a:
... (7 Replies)
Discussion started by: Jonny2Vests
7 Replies
3. Shell Programming and Scripting
Hi All,
So I found a simple sed command to replace text in a file (http://www.labnol.org/internet/design/wordpress-unix-replace-text-multiple-files/1128/):
sed -e 's/OLDtext/NEWtext/' -i file(s)
Because I'm lazy and don't want to remember this each time I want to do this, I wrote the following... (4 Replies)
Discussion started by: ScKaSx
4 Replies
4. Shell Programming and Scripting
Hi,
I have many files scattered in all different folders. I want to replace the text within all the files using a single command ( awk, sed...) Is it possible?
example
find all the files in which there is text "memory" and replace it with "branded_memories".
the files can be at the... (2 Replies)
Discussion started by: rudoraj
2 Replies
5. UNIX for Dummies Questions & Answers
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
6. Shell Programming and Scripting
Well, to make another post at this helpful forum :b::D:
I recently tried something like this, I want to replace all those numberings/letters that are located
between <string>file://localhost/var/mobile/Applications/ and /Documents/</string>
numberings =----
replace with:
first... (6 Replies)
Discussion started by: pasc
6 Replies
7. Shell Programming and Scripting
Hello everyone,
I work under Ubuntu 11.10 (c-shell)
I need a script to create a new text file whose content is the text of another text files that are in the directory $DIRMAIL at this moment.
I will show you an example:
- On the one hand, there is a directory $DIRMAIL where there are... (1 Reply)
Discussion started by: tenteyu
1 Replies
8. Shell Programming and Scripting
Hallo Everyone.
I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text.
I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern>
... (5 Replies)
Discussion started by: gordom
5 Replies
9. Shell Programming and Scripting
Please share the doc asap as very urgently required. (1 Reply)
Discussion started by: 24ajay
1 Replies
10. UNIX for Beginners Questions & Answers
Hi All-I am new to Unix , I need to write a script. Can someone help me with a requirement where I have list of files in a directory, I want to Merge the files if a pattern of string matches in filenames?
AAAL_555A_ORANGE1_F190404.TXT
AAAL_555A_ORANGE2_F190404.TXT
AAAL_555A_ORANGE3_F190404.TXT... (6 Replies)
Discussion started by: Shankar455
6 Replies
LEARN ABOUT DEBIAN
file::slurp::withinpolicy
File::Slurp::WithinPolicy(3pm) User Contributed Perl Documentation File::Slurp::WithinPolicy(3pm)
NAME
File::Slurp::WithinPolicy - Applies filesystem policies to File::Slurp
SYNOPSIS
use File::Slurp::WithinPolicy qw(:all);
my $text = read_file( 'filename' );
my @lines = read_file( 'filename' );
write_file( 'filename', $text );
append_file( 'filename', $more_text );
overwrite_file( 'filename', $text );
my @files = read_dir( '/path/to/dir' );
DESCRIPTION
This provides the File::Slurp interface within a policy defined by File::Policy. By default, File::Policy is a no-op and this behaves
identically to File::Slurp. System administrators may want to override the default File::Policy implementation to enforce a local filesys-
tem policy (see File::Policy).
FUNCTIONS
read_dir
See "read_dir" in File::Slurp
read_file
See "read_file" in File::Slurp
write_file
See "write_file" in File::Slurp
append_file
See "append_file" in File::Slurp
overwrite_file
See "overwrite_file" in File::Slurp
EXPORTS
By default, nothing is exported. The ":all" tag can be used to export everything. Individual methods can also be exported.
SEE ALSO
File::Slurp, File::Policy
VERSION
$Revision: 1.4 $ on $Date: 2005/06/15 10:40:21 $ by $Author: simonf $
AUTHOR
John Alden <cpan _at_ bbc _dot_ co _dot_ uk>
COPYRIGHT
(c) BBC 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL.
See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt
perl v5.8.8 2005-06-15 File::Slurp::WithinPolicy(3pm)