10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Input file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
2. Shell Programming and Scripting
In the below perl I am trying to extract and print the values AF1=, the GT value, and F or QUAL diveded by 33 (rounded to the nearest whole #). The GT value is at the end after the GT:PL so all the possibilities are read into a hash h, then depending on the value that is in the line the... (1 Reply)
Discussion started by: cmccabe
1 Replies
3. Shell Programming and Scripting
Gents,
I am trying to delete all lines which start with "H" character, but keeping the fist header. Example In the input file I will delete all lines starting from line 8 which contents character "H" to the end of the file.
I try
sed '8,10000{/^H/d;}' file
But as don't know the end... (1 Reply)
Discussion started by: jiam912
1 Replies
4. UNIX for Dummies Questions & Answers
I'm trying to grep lines where the digits at the end of each line are greater than digits. Tried this but it will only allow me to specify 2 digits. Any ideas would greatly be appreciated. grep -i '\<\{3,4,5\}\>' file
---------- Post updated at 05:58 PM ---------- Previous update was at 05:41... (1 Reply)
Discussion started by: jimmyf
1 Replies
5. Shell Programming and Scripting
Hi,
I've spent some time researching for this but can't seem to find a solution. I have a file like this
1234|Test|20101111|18:00|19:00There will be multiple lines in the file with the same kind of format. For every line I need to make it this
1234|Test|20101111|18:00|19:00||create... (5 Replies)
Discussion started by: giles.cardew
5 Replies
6. Shell Programming and Scripting
This is what I want to do. I want to write a script that reads each line (of the highlighted file below) and add a specific number of blank lines (sometime 2, 3 or 5 lines) at the end of each line while copying that line. For example, here is the input.
The sky is blue.
I like to eat.
I like... (19 Replies)
Discussion started by: Ernst
19 Replies
7. Programming
i am very new to Perl. i am using Ubuntu. i have a string call $string that contains following words "new line". i also have a data file as follows.
djfibjbet
etitrbjijbtr rrge rgjierjegjeri
jerijg
kijij jijij
i want to write my new line to my data file as follows.
djfibjbet... (3 Replies)
Discussion started by: usustarr
3 Replies
8. UNIX for Advanced & Expert Users
Hi
I am getting a source file where the columns are seperated by comma and double Quotes
Eg1 : "AAA","BBB","CCCC"
in the same source file i am also getting few lines where my last columns double quotes are ending in its next line or the next next line
Eg2: "AAA","BBB","CCC
CC"... (9 Replies)
Discussion started by: laxmi131
9 Replies
9. Shell Programming and Scripting
I'm sure this will be an easy question for you experts out there, but I have been searching the forum and working on this for a couple hours now and can't get it right.
I have a very messy data file that I am trying to tidy up - one of the issues is some records are split into multiple lines: ... (4 Replies)
Discussion started by: tink
4 Replies
10. Shell Programming and Scripting
--------------------------------------------------------------------------------
Have to check in a file that the lines starting with 620 and 705
are ending at same posiotin.
82012345
62023232323
70523949558
62023255454
9999
In the above lines, i have to check the lines starting... (1 Reply)
Discussion started by: senthil_is
1 Replies
Template::Plugin::Datafile(3) User Contributed Perl Documentation Template::Plugin::Datafile(3)
NAME
Template::Plugin::Datafile - Plugin to construct records from a simple data file
SYNOPSIS
[% USE mydata = datafile('/path/to/datafile') %]
[% USE mydata = datafile('/path/to/datafile', delim = '|') %]
[% FOREACH record = mydata %]
[% record.this %] [% record.that %]
[% END %]
DESCRIPTION
This plugin provides a simple facility to construct a list of hash references, each of which represents a data record of known structure,
from a data file.
[% USE datafile(filename) %]
A absolute filename must be specified (for this initial implementation at least - in a future version it might also use the
"INCLUDE_PATH"). An optional "delim" parameter may also be provided to specify an alternate delimiter character.
[% USE userlist = datafile('/path/to/file/users') %]
[% USE things = datafile('items', delim = '|') %]
The format of the file is intentionally simple. The first line defines the field names, delimited by colons with optional surrounding
whitespace. Subsequent lines then defines records containing data items, also delimited by colons. e.g.
id : name : email : tel
abw : Andy Wardley : abw@tt2.org : 555-1234
sam : Simon Matthews : sam@tt2.org : 555-9876
Each line is read, split into composite fields, and then used to initialise a hash array containing the field names as relevant keys. The
plugin returns a blessed list reference containing the hash references in the order as defined in the file.
[% FOREACH user = userlist %]
[% user.id %]: [% user.name %]
[% END %]
The first line of the file must contain the field definitions. After the first line, blank lines will be ignored, along with comment line
which start with a '"#"'.
BUGS
Should handle file names relative to "INCLUDE_PATH". Doesn't permit use of '":"' in a field. Some escaping mechanism is required.
AUTHOR
Andy Wardley <abw@wardley.org> <http://wardley.org/>
COPYRIGHT
Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Template::Plugin
perl v5.12.1 2008-11-13 Template::Plugin::Datafile(3)