hi guys,
Suppose you have 100 files in a folder and you want to replace all occurances of a word say "ABCD" in those files with "DCBA", how would you do
it ???
jatin (13 Replies)
I used the following script
cd pathname
for y in `ls *`;
do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y;
done
and it worked fine for finding and replacing strings with names etc. in all files of the given path.
I'm trying to replace a string which consists of path (location of file)
... (11 Replies)
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)
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)
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)
Hi all
This is my first post. Please bear with me with all my mistakes. I started learning shell since couple of days now and this might be quite basic for all, i want to search for files in a directory containing specific string and replace it with new string. The code i wrote is quite bulky... (2 Replies)
Hi,
Need your advices,
Input :
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 :
select code,status,input from VIEW1.VIEWNAME where... (2 Replies)
I am trying to write shell script to find and replace using Sed. but i am unable to complete the setting. need help in doing that.
Requirement:
FROM
"${O_INSTANCE}/diag/logs/${C_TYPE}/${C_NAME}/httpd.pid"
TO
"/var/opt/<SID>_<HOSTNAME>/Apache/httpd.pid" (10 Replies)
Hi,
I need to replace the space " " with underscore "_" using shell scripting. The data are inside the text file. Is there are any simple code to that.? (3 Replies)
Discussion started by: gopishrine
3 Replies
LEARN ABOUT DEBIAN
arch::tempfiles
Arch::TempFiles(3pm) User Contributed Perl Documentation Arch::TempFiles(3pm)NAME
Arch::TempFiles - help to manage temporary files/dirs
SYNOPSIS
use Arch::TempFiles qw(temp_file_name temp_file temp_dir);
# all will be removed automatically on the script completion
my $file_name1 = temp_file();
my $file_name2 = temp_file_name("status");
my $dir_name = temp_dir("arch-tree");
use Arch::TempFiles;
my $tmp = new Arch::TempFiles;
$tmp->root($tmp->dir);
my $file_name = $tmp->name;
open OUT, ">$file_name";
close OUT;
DESCRIPTION
This module deals with temporary file names. It is similar to File::Temp, but simplier and more focused. Also, File::Temp is relatively new
and was not shipped with older perl versions.
Both function interface and object oriented interface are supported.
FUNCTIONS /METHODS
The following functions are available:
temp_root, temp_name, temp_file_name, temp_dir_name, temp_file, temp_dir.
The corresponding class methods are available too:
root, name, file_name, dir_name, file, dir.
temp_root [dir]
$tmp->root [dir]
Change or return the root of the temporary files and dirs. The default is either $ENV{TMP_DIR} or "/tmp".
temp_name [label]
$tmp->name [label]
Return the unused temporary file name. The default file name is "/tmp/,,arch-XXXXXX" where XXXXXX is a random number. To change this
name use "temp_root" and/or provide label that replaces "arch".
Please note, that the operation of acquiring the file name using this function/method and actual creating of this file is not atomic.
So you may need to call this method again if the creation is failed, for example if some other process created the same file in the
middle.
temp_file_name [label]
$tmp->file_name [label]
Like "temp_name", but stores the name in the file list that will be removed on the end (on object destruction).
temp_dir_name [label]
$tmp->dir_name [label]
Like "temp_name", but stores the name in the dir list that will be removed on the end (on object destruction).
temp_file [label]
$tmp->file [label]
Like "temp_file_name", but also creates the file.
temp_dir [label]
$tmp->dir [label]
Like "temp_dir_name", but also creates the dir.
BUGS
Awaiting for your reports.
AUTHORS
Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).
SEE ALSO
For a different interface, see File::Temp.
perl v5.10.1 2005-04-22 Arch::TempFiles(3pm)