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 1482
@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
KevinADC 4,059
Recognized Expert Specialist
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 version="1.0" encoding="UTF-8"?>
<Message id="100199" version="1.9" something="1">
<Jobs id="999" priority="0">
|
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 one)
after the dialog is dismissed. Any hint is highly appreciated!
Leo
OPENFILENAME ofn;
TCHAR defDir;
TCHAR filePath;
|
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 only the files
I want to see appear in the file list box. When I change the filter to
one of the other filters, all the files in the list disappear. If I
then manually type a filter into the "Filename" textbox, then the files
appear and the filter...
|
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 want to give them the opportunity to run these modules from home as well, we are trying to get the USERNAME/COMPUTERNAME as well, so the students, when they sign up for the modules, they can ONLY run the modules fromhome PC.
We found a nice...
| |
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 or by the below program
It lets you place a palette from a file or from a program on the clipboard
and allows you to retrieve one from the clipboard. But you'll find the
retrieved one is always "Nothing"
|
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 filter on 5 fields in
this table, and can include as many field values as s/he needs.
The popup is reached from a command button on the main form
:
This button is on the main form, Datasystem:
|
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 as to get basic re-direction and piping working.
The only problem I have is when the user decides not to use re-direction, or a file, and instead they decide to enter text directly in the Terminal.
I have this loop for looping through a...
|
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 "No Filter defined for the PDF file",
So how can we define the Filter for PDF file, so that iFilter can extract it's text.
Thanks in advance,
|
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 just the ones
that I want. I used the statement before and though it displays the
*.csproj files it does not display the *.sln files.
openFileDialog.Filter = "Solution Files (*.sln) And Project Files
(*.csproj)|*sln ;*.csproj|All Files...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: 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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |