Sponsored Content
Top Forums UNIX for Dummies Questions & Answers parsing with multible delimiters Post 17704 by gillbates on Tuesday 19th of March 2002 02:34:14 PM
Old 03-19-2002
I can't seem to get that to work

I tried to execute that code but it doesn't seem to work. Here's what I've tried so far and the actual data:

$stri="369!pcust-ap03!f0gaudf5/Deal30/test/ma26_3_1arms_showout.xls!232448!Mar_4_13:04";


if ($stri =~ /(\w+)!(\w+)!(\w+)\/(\w+)\/(\S+)/) {
print (STDERR "\taaa is $1\n");
print "\tbbb is $2\n";
print "\tccc is $3\n";
print "\tddd is $4\n";
print "\teee is $5\n";
};

The three lines of data are really one long string. Thanks, Gill
 

10 More Discussions You Might Find Interesting

1. Solaris

To extract everything between two delimiters

My input file looks like " @$SCRIPT/atp_asrmt_adj.sql $SCRIPT/dba2000.scr -s / @$SCRIPT/cim1005w.pls $SCRIPT/dba2000.scr -s / @$SCRIPT/cim1006w.pls start $SCRIPT/cim1020d.sql;^M spool $DATA/cim1021m.sql @$DATA/cim1021m.sql ! rm $DATA/cim1021m.sql spool $DATA/cim1021m.sql... (1 Reply)
Discussion started by: dowsed4u8
1 Replies

2. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

3. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

4. Shell Programming and Scripting

Two delimiters with AWK

Hello, this thread is more about scripting style than a specific issue. I've to grep from a output some lines and from them obtain a specific entry delimited by < and >. This is my way : 1) grep -i user list | awk '{FS="<";print $NF}' | sed -e 's/>//g' 2) grep -i user list | cut -d","... (10 Replies)
Discussion started by: gogol_bordello
10 Replies

5. Shell Programming and Scripting

sort with different delimiters

I have a file with the following lines in it: Inbound1:remote - - 01/Nov/2011:08:29:51 -0500 "GET / HTTP/1.1" 404 2098 HTTP Inbound1:remote - - 02/Dec/2011:08:31:42 -0500 "GET / HTTP/1.1" 404 2098 HTTP Inbound3:remote - - 01/Oct/2011:08:29:52 -0500 "GET / HTTP/1.1" 404 2098 HTTP Inbound4:remote... (5 Replies)
Discussion started by: oldman2
5 Replies

6. UNIX for Dummies Questions & Answers

delimiters used in UNIX

Can you point me to information on the different delimited in UNIX like colon, spaces and tabs? (1 Reply)
Discussion started by: momhef4
1 Replies

7. Shell Programming and Scripting

Inserting Delimiters

Hi Team, I am trying to get the data in below format Jan 01 | 19:00:32 | xyz | abc | sometext | string however I am not sure of the total number strings which can come in the record hence i cant use something like below as it can end $6 or it can go further cat file| awk... (8 Replies)
Discussion started by: rakesh_411
8 Replies

8. Shell Programming and Scripting

Delimiters with awk?

I have a file which is separated by delimiter "|", but the prob is one of my column do contain delimiter as description so how can i differentiate it? PS : the delmiter does have backslash coming before it, if occurring in column Annual|Beleagured|Desc|Denver... (2 Replies)
Discussion started by: nikhil jain
2 Replies

9. Programming

Segfault When Parsing Delimiters In C

Another project, another bump in the road and another chance to learn. I've been trying to open gzipped files and parse data from them and hit a snag. I have data in gzips with a place followed by an ip or ip range sort of like this: Some place:x.x.x.x-x.x.x.x I was able to modify some code... (6 Replies)
Discussion started by: Azrael
6 Replies

10. Shell Programming and Scripting

--Parsing out strings for repeating delimiters for everyline

Hello: I have some text output, on SunOS 5.11 platform using KSH: I am trying to parse out each string within the () for each line. I tried, as example: perl -lanF"" -e 'print "$F $F $F $F $F $F"' But for some reason, the output gets all garbled after the the first fields.... (8 Replies)
Discussion started by: gilgamesh
8 Replies
FPUTCSV(3)								 1								FPUTCSV(3)

fputcsv - Format line as CSV and write to file pointer

SYNOPSIS
int fputcsv (resource $handle, array $fields, [string $delimiter = ","], [string $enclosure = '"'], [string $escape_char = " DESCRIPTION
fputcsv(3) formats a line (passed as a $fields array) as CSV and write it (terminated by a newline) to the specified file $handle. PARAMETERS
o $handle -The file pointer must be valid, and must point to a file successfully opened by fopen(3) or fsockopen(3) (and not yet closed by fclose(3)). o $fields - An array of values. o $delimiter - The optional $delimiter parameter sets the field delimiter (one character only). o $enclosure - The optional $enclosure parameter sets the field enclosure (one character only). o $escape_char - The optional $escape_char parameter sets the escape character (one character only). RETURN VALUES
Returns the length of the written string or FALSE on failure. CHANGELOG
+--------+---------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------+ | 5.5.4 | | | | | | | The $escape_char parameter was added | | | | +--------+---------------------------------------+ EXAMPLES
Example #1 fputcsv(3) example <?php $list = array ( array('aaa', 'bbb', 'ccc', 'dddd'), array('123', '456', '789'), array('"aaa"', '"bbb"') ); $fp = fopen('file.csv', 'w'); foreach ($list as $fields) { fputcsv($fp, $fields); } fclose($fp); ?> The above example will write the following to file.csv: aaa,bbb,ccc,dddd 123,456,789 """aaa""","""bbb""" NOTES
Note If PHP is not properly recognizing the line endings when reading files either on or created by a Macintosh computer, enabling the auto_detect_line_endings run-time configuration option may help resolve the problem. SEE ALSO
fgetcsv(3). PHP Documentation Group FPUTCSV(3)
All times are GMT -4. The time now is 10:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy