i have a file:
date: 02-02-2006
name: geopar
doc: test machine
username: test1
password: p4ss
address: test2
phone: 343534543535
username: test
fax: 453453534
etc.....
i want to generate a new file with data : (username password)
(a script to check for structure
username:
password:
in file, and if found dump username & password to outfile..)
help :)
2 1462
@superc0red
The basic idea is: - @file = (
-
"date: 02-02-2006",
-
"name: geopar",
-
"doc: test machine",
-
"username: test1",
-
"password: p4ss",
-
"address: test2",
-
"phone: 343534543535",
-
"username: test",
-
"fax: 453453534",
-
"",
-
"date: 02-02-2006",
-
"name: geopar",
-
"doc: test machine",
-
"username: test2",
-
"password: p5ss",
-
"address: test2",
-
"phone: 343534543535",
-
"username: test",
-
"fax: 453453534",
-
);
-
-
for $line ( @file ) {
-
if ( $line =~ m/^username:\s+(.*)$/ ) {
-
$user = $1;
-
}
-
elsif ( $line =~ m/^password:\s+(.*)$/ ) {
-
$pw = $1;
-
-
printf("$user $pw\n");
-
-
$user = $pw = undef;
-
}
-
}
Reading in the input file and writing the result to the output file instead of printing it is left to you as an exercise ;o)
Greetz, Doc
i have a file:
date: 02-02-2006
name: geopar
doc: test machine
username: test1
password: p4ss
address: test2
phone: 343534543535
username: test
fax: 453453534
etc.....
i want to generate a new file with data : (username password)
(a script to check for structure
username:
password:
in file, and if found dump username & password to outfile..)
help :)
Do you have any existing code? If so maybe it just needed a small tweak to work. If not, Docs suggestion should get you over the hump.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mcc |
last post by:
When i put these two java scripts in the same html file only the fade script
works.
Why is that???
this part is in the <head>
|
by: Thomas |
last post by:
Hi,
I used xsd.exe to generate a *.xsd file from the *.xml-File and then I
created a typed DataSet in VisualStudio 2003
But now I have problems to read the data from the DataSet.
<?xml...
|
by: Leo |
last post by:
I am using OPENFILENAME and GetSaveFileName to let user save a
document out. However, the default name won't show up in the dialog and
the selected filter can't be obtained (always got the default...
|
by: marcus.kwok |
last post by:
I am having a weird problem and I have can't figure out why it is
happening. I create an OpenFileDialog and set a filename filter. When
the dialog first opens, the filter works correctly, and...
|
by: sunbeam |
last post by:
Short Description of the Project:
we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
|
by: active |
last post by:
Below is a small but complete program that appears to show you
can't retrive a Palette from the clipboard.
This is true whether the palette is placed on the clipboard by Photoshop or
Photoshop...
|
by: Thelma Roslyn Lubkin |
last post by:
I am still having trouble trying to use a popup form to allow user to
set filters for the main form.
The main form is based on a single table.
The popup contains 5 listboxes, so the user can...
|
by: Gotejjeken |
last post by:
I am currently working on an email filter, and it will either get input from a file and then filter junk mail out, or get mail from cin. I have the file part working correctly, and I even got as far...
|
by: my4color |
last post by:
Hello everyone,
we are creating the PDF file using the iTextSharp.
After creating that file we are using the Acrobat's iFilter for extracting text from that PDF file.
But we get the exception...
|
by: Z.K. |
last post by:
I would like to display two different types of files when bringing up
the OpenFileDialog, but I can't seem to figure out how to do this. I
can manage a single file type or all file types, but not...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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...
|
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,...
| |