I have a text file with the fields such as as follows:
"name", "age", "profession ", "street", "city", "statezip"
For example:
"joe", "24", "nurse", "1234 Coffee Lane", "Fremont", "CA94555"
I would like to split the last field ("ca94555") so that the output file reads as follows:
"joe", "24", "nurse", "1234 Coffee Lane", "Fremont", "CA", "94555"
I know how to process the text but don;t know how to split any field.
Any help will be appreciated.
-Vic
2 1217 KevinADC 4,059
Recognized Expert Specialist
next time post the code you have written so far: - $field = 'CA94555';
-
my ($state,$zip) = $field =~ /^([a-zA-Z]+)(\d+)$/;
Thanks Kevin for your help. I will test my script an post the results.
-Vic
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Richard Galli |
last post by:
I want viewers to compare state laws on a single subject.
Imagine a three-column table with a drop-down box on the top. A viewer
selects a state from the list, and that state's text fills the column below.
The viewer can select states from the drop down lists above the other two
columns as well. If the viewer selects only one, only one column fills. If
the viewer selects two states, two columns fill. Etc.
I could, if appropriate, have...
|
by: Ed Suominen |
last post by:
I'm thinking of implementing a real-time collaborative text editor in Python
using Twisted. An initial plan is to use a Twisted PB server daemon that
accepts user:password:file connections from text editor clients to make
changes to a specified file on the server, and have the text editor clients
update their local copies of the file based on local user input or input
entered from other users, relayed via the server.
Jabber compatibility...
|
by: Jocknerd |
last post by:
I'm a Python newbie and I'm having trouble with Regular Expressions when
reading in a text file. Here is a sample layout of the input file:
09/04/2004 Virginia 44 Temple 14
09/04/2004 LSU 22 Oregon State 21
09/09/2004 Troy State 24 Missouri 14
As you can see, the text file contains a list of games. Each game has a
date, a winning team, the winning...
|
by: dornick |
last post by:
So I want to do the above, and I really, REALLY don't want to rewrite
the entire file. I've been working on it for a while now, and can't
for the life of me get it functioning. Basically, I want to replace
the last text character of a certain line.
So far all I've done has centered around trying to put the "put"
pointer write before the character to write (ban pun, I know). But
when I tried to use put(), nothing happened and a call to...
|
by: sonald |
last post by:
Hi,
Can anybody tell me how to change the text delimiter in FastCSV Parser
?
By default the text delimiter is double quotes(")
I want to change it to anything else... say a pipe (|)..
can anyone please tell me how do i go about it?
| |
by: rn5a |
last post by:
Can someone please suggest me a text editor especially for DEBUGGING
ASP scripts apart from Microsoft Visual Interdev?
I tried using Visual Interdev & created a project but Interdev
generates some error related to FrontPage extensions. I couldn't
exactly understand the error. I tried to create the project in C:
\Inetpub\wwwroot. If I just open a ASP file (by navigating to the
File-->Open File... menu), then Interdev doesn't give the...
|
by: edwire |
last post by:
I'm totally lost! I've been trying for several days to make Onblur fill in the city, state after the user inputs inside a textbox a 5 digit zip code, from the the zip, city, state text boxes I want to extract the info and pu it in a separate line like this:
a) user puts a zipcode:95051
b) Onblur fills in city and state
c) a new line in the same page showing ex.
Support Services
SantaClara,CA 95051
I have a test page loaded with all the...
|
by: John Brawley |
last post by:
Is this going to cause me a portability problem?
Purpose: make it easy for me to write my 'help' text block in the .cpp file,
just as I wish it to be output 'formatted-ly' to the user upon demand while
the program is running.
#include <iostream>;
using namespace std;
int main() {
cout<<"these \
|
by: Hags007 |
last post by:
I have a XML file I am working with. This file has been created by hand and I now need to develop a PHP script that will create it in the same format.
Here is what I have thus far:
$query = "select * from " . $table_name . " ORDER BY stateID ASC";
$result = mysql_query($query, $connection) or die("Could not complete database query");
$num = mysql_num_rows($result);
if ($num != 0) {
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |