473,382 Members | 1,651 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Edit a text file with perl

ironmonkey69
Can anyone help me write a perl script that edits a text file? The test file has three line of text and twelve columns of numbers. The ranges of numbers are 0-2500. the first number in all of the columns is zero. I need to be able to select one of the colums and be able to change all the values in that column to zero.
Jul 13 '07 #1
6 2987
miller
1,089 Expert 1GB
NO.

What have you tried thus far?

- Miller
Jul 13 '07 #2
I have tried using different regular expressions to select a colum but have only been able to select the last column and zero that one out.
Jul 13 '07 #3
miller
1,089 Expert 1GB
Show us the code.

I have a feeling that the following will most likely become helpful:

perldoc perlfaq5 How do I change one line in a file/delete a line in a file/insert a line in the middle of a file/append to the beginning of a file?

- Miller
Jul 13 '07 #4
this what I have "s/[0-9][0-9]*$/0/g"
Jul 13 '07 #5
miller
1,089 Expert 1GB
this what I have "s/[0-9][0-9]*$/0/g"
All your code, including that to process the text file. And while you're at it, the test file itself.

- Miller
Jul 13 '07 #6
KevinADC
4,059 Expert 2GB
hehehe.. nothing like a good old tooth pulling session ;)
Jul 13 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: news.verizon.net | last post by:
I'm working through the examples in Jeffrey E. F. Friedl's book 'Mastering Regular Expressions, 2nd Ed.'. I'm trying to work the example at the top of p. 53, but I'm attempting it in a command...
1
by: rk | last post by:
Hi, I'm trying to write a cgi/perl programs to post a report like the following format in which the the user has to feed the values(nos) in the boxes under % Done Qual Rel. Stab P1 p2 P3.......
0
by: Alex | last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk The DataList is not as powerful as the DataGrid. It requires more work from you since it has no default data presentation format....
4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
1
by: ollielaroo | last post by:
Hi guys, Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site. My problem is...
5
by: deppeler | last post by:
Can someone look at this for me: I am trying to set up a script to edit an item in a flat file DB but I don't seem to be getting the data to the Photoedit script. It seems to be reading the 1st line...
21
by: Mick1000 | last post by:
Hi all, I am new to perl and this forum. I am trying to setup a mailing list subscription functionality for customers to receive a periodic newsletter from me. My perl program grabs the html form...
1
by: Xah Lee | last post by:
Text Processing with Emacs Lisp Xah Lee, 2007-10-29 This page gives a outline of how to use emacs lisp to do text processing, using a specific real-world problem as example. If you don't know...
1
by: varsha21 | last post by:
Hi, I am writing a command line perl program to convert a file in dos format to unix format. I know that the following instruction executes successfully on one of the unix machine. I am trying...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.