There has to be something wrong about this code. I am still trying...
For the attached files. The output is:
In other words the script is not printing the x/y values and it only prints only the first price of each file (i took a sample of 3 files) in one column not in one row.
The output, according to these sample files should be like:
Hi,
I have file1.txt and file2.txt and would like to create file3.txt based on one column in UNIX
Eg:
file1.txt
17328756,0000786623.pdf,0000786623
20115537,0000793892.pdf,0000793892
file2.txt
12521_74_4.zip,0000786623.pdf
12521_15_5.zip,0000793892.pdf
Desired Output
... (5 Replies)
I have 100 data files labelled 250.1.txt through 250.100.txt. The second column of the data files partially match (there is about %90 overlap). Each data file has 4 columns.
I want the merge all these text files by the matching values in the second column. In the output, the first column should... (1 Reply)
Hi
I have multiple files each with two columns and I need to combine all those file into a tab delimited file. (multiple entry with same name separated by a comma)
The content of the files are as follows:
---
file1.txt:
name var1
aaa xx
aaa gg
bbb yy
ddd zz
---
file2.txt
... (8 Replies)
Hi,
Can anyone suggest quick way to get desired output?
Sample input file content:
A 12 9
A -0.3 2.3
B 1.0 -4
C 34 1000
C -111 900
C 99 0.09
Output required:
A 12 9 -0.3 2.3
B 1.0 -4
C 34 1000 -111 900 99 0.09
Thanks (3 Replies)
Hi all,
I'm looking for a way to merge multiple columns (from one file) into a single column in an output file.
The file I have looks somewhat like this:
@HWI-ST212 1:N:0 AGTCCTACCGGGAGT + @@@DDDDDHHHHHII
@HWI-ST212 1:N:0 CGTTTAAAAATTTCT + @;@B;DDDDH?:F;F... (4 Replies)
Hi All,
I am trying to merge all the text files into one file using below snippet
cat /home/Temp/Test/Log/*.txt >> all.txt
But it seems it is not working.
I have multiple files like Output_ServerName1.txt, Output_ServreName2.txt
I want to merge each file into one single file and... (6 Replies)
Hi All,
I have 4 files in below format. I took them as an example.
File 1: Cut from position 1-4 then 6-7 then 8-14 then rest left and make them as columns in one new file. Inserting character H to the initial of all line like HCTOT.
CTOT 456787897 Low fever
CTOR 556712345 High fever... (2 Replies)
Hi ALL,
I have two file. I need to combine these two file based on a layout.
I used the below code and able to extract the record. But now able to insert that to a 3'rd file in between the extract
FILE 1
CAID NUMBER 1-20
TID NUMBER 21-22
LABEL CHAR 23-44
BASE 45-60... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
LEARN ABOUT PHP
yaml_parse
YAML_PARSE(3) 1 YAML_PARSE(3)yaml_parse - Parse a YAML streamSYNOPSIS
mixed yaml_parse (string $input, [int $pos], [int &$ndocs], [array $callbacks])
DESCRIPTION
Convert all or part of a YAML document stream to a PHP variable.
PARAMETERS
o $input
- The string to parse as a YAML document stream.
o $pos
- Document to extract from stream ( -1 for all documents, 0 for first document, ...).
o $ndocs
- If $ndocs is provided, then it is filled with the number of documents found in stream.
o $callbacks
- Content handlers for YAML nodes. Associative array of YAML tag => callable mappings. See parse callbacks for more details.
RETURN VALUES
Returns the value encoded in $input in appropriate PHP type or FALSE on failure. If $pos is -1 an array will be returned with one entry
for each document found in the stream.
EXAMPLES
Example #1
yaml_parse(3) example
<?php
$yaml = <<<EOD
---
invoice: 34843
date: "2001-01-23"
bill-to: &id001
given: Chris
family: Dumars
address:
lines: |-
458 Walkman Dr.
Suite #292
city: Royal Oak
state: MI
postal: 48046
ship-to: *id001
product:
- sku: BL394D
quantity: 4
description: Basketball
price: 450
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392
tax: 251.420000
total: 4443.520000
comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.
EOD;
$parsed = yaml_parse($yaml);
var_dump($parsed);
?>
The above example will output something similar to:
array(8) {
["invoice"]=>
int(34843)
["date"]=>
string(10) "2001-01-23"
["bill-to"]=>
&array(3) {
["given"]=>
string(5) "Chris"
["family"]=>
string(6) "Dumars"
["address"]=>
array(4) {
["lines"]=>
string(34) "458 Walkman Dr.
Suite #292"
["city"]=>
string(9) "Royal Oak"
["state"]=>
string(2) "MI"
["postal"]=>
int(48046)
}
}
["ship-to"]=>
&array(3) {
["given"]=>
string(5) "Chris"
["family"]=>
string(6) "Dumars"
["address"]=>
array(4) {
["lines"]=>
string(34) "458 Walkman Dr.
Suite #292"
["city"]=>
string(9) "Royal Oak"
["state"]=>
string(2) "MI"
["postal"]=>
int(48046)
}
}
["product"]=>
array(2) {
[0]=>
array(4) {
["sku"]=>
string(6) "BL394D"
["quantity"]=>
int(4)
["description"]=>
string(10) "Basketball"
["price"]=>
int(450)
}
[1]=>
array(4) {
["sku"]=>
string(7) "BL4438H"
["quantity"]=>
int(1)
["description"]=>
string(10) "Super Hoop"
["price"]=>
int(2392)
}
}
["tax"]=>
float(251.42)
["total"]=>
float(4443.52)
["comments"]=>
string(68) "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338."
}
NOTES
Warning
Processing untrusted user input with yaml_parse(3) is dangerous if the use of unserialize(3) is enabled for nodes using the
!php/object tag. This behavior can be disabled by using the yaml.decode_php ini setting.
SEE ALSO yaml_parse_file(3), yaml_parse_url(3), yaml_emit(3).
PHP Documentation Group YAML_PARSE(3)