10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
The awk below uses the tab-delimeted fileand reformats each line based on one of three conditions (rules). The 3 rules are for deletion (lines in blue), snv (line in red), and insertion (lines in green). I have included all possible combinations of lines from my actual data, which is very large.... (0 Replies)
Discussion started by: cmccabe
0 Replies
2. Shell Programming and Scripting
Hi,
I have a file like below.
1,2,3,4,5,6,7,8,9I would like to print or copied to a file based of line count in perl
If I gave a condition 1 to 3 then it should iterate over above file and print 1 to 3 and then again 1 to 3 etc.
output should be
1,2,3
4,5,6
7,8,9 (10 Replies)
Discussion started by: Anjan1
10 Replies
3. Shell Programming and Scripting
I want to keep last 2 days data from a file and want to delete others data from the file. Please help me.
Sample Input
# cat messages-2
Apr 15 11:25:03 test1 kernel: imklog 4.6.2, log source = /proc/kmsg started.
Apr 15 11:25:03 test1 rsyslogd: (re)start
Apr 16 19:42:03 test1 kernel:... (2 Replies)
Discussion started by: makauser
2 Replies
4. Shell Programming and Scripting
Hi All,
I have following listing
Filesystem GB blocks Free Used Iused Iused Mounted on
/dev/hd2 4.00 0.31 93 63080 43 /usr
Filesystem GB blocks Free Used Iused Iused Mounted on
Filesystem GB blocks Free Used Iused Iused... (11 Replies)
Discussion started by: ckwan
11 Replies
5. Shell Programming and Scripting
Hi Folks
I'm looking for help with if statement.
I'm reading the file with header (starts with 0 on position 1 in the line) and data (starts with 1 on position 1 in the line).
I have to check if the number from header (should be number of data rows) equal actual count of the data rows.
... (4 Replies)
Discussion started by: viallos
4 Replies
6. Shell Programming and Scripting
This is a variation of an earlier post found here:
unixcom/shell-programming-scripting/159821-merge-two-non-consecutive-lines.html
User Bartus11 was kind enough to solve that example.
Previously, I needed help combining two lines that are non-consecutive in a file. Now I need to do the... (7 Replies)
Discussion started by: munkee
7 Replies
7. Shell Programming and Scripting
Hi,
I need to remove some lines from an XML file is the value within a tag is empty.
Imagine this scenario,
<acd><acdID>2</acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
I... (3 Replies)
Discussion started by: giles.cardew
3 Replies
8. Shell Programming and Scripting
Hi folks,
I have a text file that I need to parse, and I cant figure it out. The source is a report breaking down softwares from various companies with some basic info about them (see source snippet below). Ultimately what I want is an excel sheet with only Adobe and Microsoft software name and... (5 Replies)
Discussion started by: rowie718
5 Replies
9. Shell Programming and Scripting
Hi
I'm trying to find a way to search a text file for a specific string.
I have a file which contains i.p. addresses and port numbers in the following format:
'ip="www.xxx.yyy.zzz"'
'port="xx""'
I want to print only the parts between the double quotes for use in seperate variables,... (4 Replies)
Discussion started by: melias
4 Replies
10. Shell Programming and Scripting
hi ,
I have a String str="/opt/ibm/lotus/ibw/latest" or ="/opt/lotus/ibw/latest" this value is dynamic..I want to split this string into 2 strings
1. /opt/ibm/lotus(/opt/lotus) this string must ends with "lotus"
2./ibw/latest
can any body help me on this?
Regards,
sankar (2 Replies)
Discussion started by: sankar reddy
2 Replies
YAML_PARSE(3) 1 YAML_PARSE(3)
yaml_parse - Parse a YAML stream
SYNOPSIS
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)