06-15-2009
There are tons of tutorials out there, I think what you need is a push in the right direction.
Perl can open a file for reading, writing or both (this is a simplification, there's no need for the pedants out there to point this out.) It uses the concept of file handles to do so.
I'd suggest a google search for:
perl file handles
perl open file reading
perl open file writing
You're also going to use a while loop to read the file, so I'd suggest reading up on that too.
HTH, post again with more specific questions.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all
I need to replace all characters in a file except for the matching pattern
eg.
I need to replace all character with '*' except for the pattern "abc"
Input
"sdfhgsdf abc ##%$#abcsdfh sdfjkfff"
Output
"******abc******abc*************"
Request for single liner solution (1 Reply)
Discussion started by: raghav288
1 Replies
2. Shell Programming and Scripting
Hi,
I am trying to edit an XML file automatically but my regex and shell script knowledge is very limited. I would appreciate your help fellows.
The XML file has this structure:
<?xml version="1.0" encoding="UTF-8"?>
<map map_file="maps/world.swf" zoom="350%" zoom_x="-115%"... (1 Reply)
Discussion started by: boonymagique
1 Replies
3. Shell Programming and Scripting
Experts,
I am a beginner to Unix Shell Scripting
We have source as a flat file which contains CTRL+F character as the delimiter. We need to count the number of records in the file (CTRL+F) to perform file validation
Following command being used:
awk '{cnt+=gsub(//,"&")}END {print cnt}'... (4 Replies)
Discussion started by: srivijay81
4 Replies
4. Homework & Coursework Questions
I need to write an Unix script to report the number of SQL files in my home directory, ending with .sql . The script should, also, be checking whether there is a file with an underscore in its name. If that is the case, the underscore should be converted to a dash (‐); for example... (1 Reply)
Discussion started by: ronoz-4
1 Replies
5. Shell Programming and Scripting
I have file 1 & file 2 with content mentioned below. I want to get the output as shown in file3.
Requirement:
check the content of column 1 & column 2, if value of column 1 in file1 matches with first column of file2 then remaining columns(2&3) of file2 should get replaced, also if value of... (4 Replies)
Discussion started by: siramitsharma
4 Replies
6. Shell Programming and Scripting
I wrote a Bash script which checks to see if a text string exists on a web page and then sends me an email if it does (or does not e.g. "Out of stock"). I run it from my crontab, it's quite handy from time to time and I've been using it for a few years now.
The script uses wget to download an... (6 Replies)
Discussion started by: gencon
6 Replies
7. Shell Programming and Scripting
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies
8. Shell Programming and Scripting
Here is the task that I was presented with:
I am dealing with about a 10,000 line input deck file for an analysis. About 10 separate blocks of around 25 lines of code each need to be updated in the input deck.
The input deck (deckToChange in the code below) comes with 2 separate files. File 1... (5 Replies)
Discussion started by: tiktak292
5 Replies
9. Shell Programming and Scripting
I have an awk related question that I was hoping you all could help with.
I am given 2 input files named OLDFILE and NEWFILE, and a Master file named MASTERFILE. They can be seen below.
OLDFILE:
a
a
a
a
a
f
g
4
5
7
8
1
2
3 (1 Reply)
Discussion started by: tiktak292
1 Replies
10. Shell Programming and Scripting
Dear All,
Need your help..:D
I am not regular on shell scripts..:(
I have 2 files..
Content of file1
cellRef 4};"4038_2_MTNL_KALAMBOLI"
cellRef 1020};"4112_3_RAINBOW_BLDG"
cellRef 134};"4049_2_TATA_HOSPITAL"
cellRef 1003};"4242_3_HITESH_CONSTRUCTION"
cellRef... (6 Replies)
Discussion started by: ailnilanjan
6 Replies