12-02-2014
This is quite incomplete a specification. Your "Given" is in a file? You want to parse multiple input files named "chrn_GEN2bim" where n comes from your "Given" file? Is the first column of those input files always identical to n?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am a newbie to awk and c programming, however am not a unix newbie. However, I do need help with a kshell script I am writing. It is almost complete, the last step is killing me. Any help would be greatly appreciated. What I am trying to do is cat a text file that has usernames. Then, using... (2 Replies)
Discussion started by: synergy_texas
2 Replies
2. Shell Programming and Scripting
Hi All,
I am trying to pass a parameter to AWK on my KSH shell prompt as below.
var1=2
echo $var1
awk -v var2=${var1} '{print var2}' testfile.txt
I am passing the input file (testfile) to awk to get some o/p. It is having 10 records.
When I run AWK, it is throwing the following errors... (1 Reply)
Discussion started by: Raamc
1 Replies
3. Shell Programming and Scripting
Hi,
I am trying to print a specific line in a file through sed or awk. The line number will be passed as a parameter from the previous step. My code looks as below.
TEMP3=`sed -n '$TEMP2p' $FILEPATH/Log.txt`
$TEMP2, I am getting from the previous step which is a numerical value(eg:3).
... (2 Replies)
Discussion started by: satyasrin82
2 Replies
4. Shell Programming and Scripting
I have an for loop that reads the following file
cat param.cfg
val1:env1:opt1
val2:env2:opt2
val3:env3:opt3
val4:env4:opt4
.
.
The for loop extracts the each line of the file so that at any one point, the value of i is
val1:env1:opt1 etc...
I would like to extract each... (19 Replies)
Discussion started by: goddevil
19 Replies
5. Shell Programming and Scripting
I have to replace the pattern found in one file in another file with null/empty "" if found on the fields 3 or 4 ONLY
File 1
====
10604747|Mxdef|9999|9999|9999|2012-03-04 00:00:59
10604747|Mcdef|8888|9999|8888|2012-03-04 00:00:59
.
.
.
File 2
====
9999
8888
.
.
.
Expected... (7 Replies)
Discussion started by: machomaddy
7 Replies
6. Shell Programming and Scripting
Learning, stumbling! My progress in shell scripting is slow. Now I have this doubt:
I have the following file (users.txt):
AU0909,on
AU0309,off
AU0209,on
AU0109,off
And this file (userson.txt)
AU0909
AU0209
AU0109
AU0309
I just want to set those users on userson.txt to "off" in... (14 Replies)
Discussion started by: quinestor
14 Replies
7. Shell Programming and Scripting
i am passing input parameter 'one_two' to the script , the script output should display the result as below
one_1two
one_2two
one_3two
if
then
echo " Usage : <$0> <DATABASE> "
exit 0
else
for DB in 1 2 3
do
DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}`
done
fi (5 Replies)
Discussion started by: only4satish
5 Replies
8. Shell Programming and Scripting
Hi,
I have a situation where I need to create a SQL statement using Unix script for each value in first field (ID). The file looks like this.
Id,TARGET_FIELD_NAME,SOURCE_FIELD_NAME
1,Test_Rate,Field1
1,Test_Factor,Field2
1,Test_Size,Field3
2,Test_Rate,Field4
2,Test_Factor,Field5... (3 Replies)
Discussion started by: kiranredz
3 Replies
9. UNIX for Dummies Questions & Answers
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff |... (1 Reply)
Discussion started by: Sarita Behera
1 Replies
10. Shell Programming and Scripting
Hi All,
I am new to AWK programming. I have the following for loop in my awk program.
cat printhtml.awk:
BEGIN
-------- <some code here>
END{
----------<some code here>
for(N=0; N<H; N++)
{
for(M=5; M<D; M++) print "\t" D "";
}
-----
}
... (2 Replies)
Discussion started by: ctrld
2 Replies
LEARN ABOUT DEBIAN
poe::filter::line
POE::Filter::Line(3pm) User Contributed Perl Documentation POE::Filter::Line(3pm)
NAME
POE::Filter::Line - serialize and parse terminated records (lines)
SYNOPSIS
#!perl
use POE qw(Wheel::FollowTail Filter::Line);
POE::Session->create(
inline_states => {
_start => sub {
$_[HEAP]{tailor} = POE::Wheel::FollowTail->new(
Filename => "/var/log/system.log",
InputEvent => "got_log_line",
Filter => POE::Filter::Line->new(),
);
},
got_log_line => sub {
print "Log: $_[ARG0]
";
}
}
);
POE::Kernel->run();
exit;
DESCRIPTION
POE::Filter::Line parses stream data into terminated records. The default parser interprets newlines as the record terminator, and the
default serializer appends network newlines (CR/LF, or "x0Dx0A") to outbound records.
Record terminators are removed from the data POE::Filter::Line returns.
POE::Filter::Line supports a number of other ways to parse lines. Constructor parameters may specify literal newlines, regular
expressions, or that the filter should detect newlines on its own.
PUBLIC FILTER METHODS
POE::Filter::Line's new() method has some interesting parameters.
new
new() accepts a list of named parameters.
In all cases, the data interpreted as the record terminator is stripped from the data POE::Filter::Line returns.
"InputLiteral" may be used to parse records that are terminated by some literal string. For example, POE::Filter::Line may be used to
parse and emit C-style lines, which are terminated with an ASCII NUL:
my $c_line_filter = POE::Filter::Line->new(
InputLiteral => chr(0),
OutputLiteral => chr(0),
);
"OutputLiteral" allows a filter to put() records with a different record terminator than it parses. This can be useful in applications
that must translate record terminators.
"Literal" is a shorthand for the common case where the input and output literals are identical. The previous example may be written as:
my $c_line_filter = POE::Filter::Line->new(
Literal => chr(0),
);
An application can also allow POE::Filter::Line to figure out which newline to use. This is done by specifying "InputLiteral" to be undef:
my $whichever_line_filter = POE::Filter::Line->new(
InputLiteral => undef,
OutputLiteral => "
",
);
"InputRegexp" may be used in place of "InputLiteral" to recognize line terminators based on a regular expression. In this example, input
is terminated by two or more consecutive newlines. On output, the paragraph separator is "---" on a line by itself.
my $paragraph_filter = POE::Filter::Line->new(
InputRegexp => "([x0Dx0A]{2,})",
OutputLiteral => "
---
",
);
PUBLIC FILTER METHODS
POE::Filter::Line has no additional public methods.
SEE ALSO
Please see POE::Filter for documentation regarding the base interface.
The SEE ALSO section in POE contains a table of contents covering the entire POE distribution.
BUGS
The default input newline parser is a regexp that has an unfortunate race condition. First the regular expression:
/(x0Dx0A?|x0Ax0D?)/
While it quickly recognizes most forms of newline, it can sometimes detect an extra blank line. This happens when a two-byte newline
character is broken between two reads. Consider this situation:
some stream dataCR
LFother stream data
The regular expression will see the first CR without its corresponding LF. The filter will properly return "some stream data" as a line.
When the next packet arrives, the leading "LF" will be treated as the terminator for a 0-byte line. The filter will faithfully return this
empty line.
It is advised to specify literal newlines or use the autodetect feature in applications where blank lines are significant.
AUTHORS & COPYRIGHTS
Please see POE for more information about authors and contributors.
perl v5.14.2 2012-05-15 POE::Filter::Line(3pm)