Just for fun ( with the original requirements "3 lines" ) ....
Code:
# cat gen.pl
#!/usr/bin/perl
use strict;
my $meta=shift;
my $dat=shift;
my $destination=shift;
open (META,"<",$meta ) || die "cant't open file $meta \n";
my (%metadata,@line);
while (<META>) {
/^(\d+),(\S+)\s+(\S),(\S+)\s+(\S)/;
$metadata{$1.$2.$3} = $4.":".$5;
}
close(META);
open (DAT,"<",$dat ) || die "cant't open file $dat \n";
open (DEST,">",$destination ) || die "cant't open file $destination \n";
while (<DAT>) {
/^\S+\s+(\S+)\s+(\S)\S+\s+\S+\s+\S+\s+\S+$/;
if ($1 && $2 ) {
$line[0]=$_;
my ($tCode,$sig)=($1,$2);
$_=<DAT>;
$line[1]=$_;
/\s+\S+(\d{4})\S+\s+.*$/;
if ( $1) {
my $bCode=$1;
if ($metadata{$bCode.$tCode.$sig}) {
$metadata{$bCode.$tCode.$sig}=~/(\S+):(\S)/;
my ($newTcode,$newSig)=($1,$2);
$_=$line[0];
s/^(\S+\s+)(\S+)(\s+)(\S)(\S+\s+\S+\s+\S+\s+\S+)$/\1$newTcode\3$newSig\5/;
print DEST;
print DEST $line[1];
$_=<DAT>;
print DEST ;
}
else {
print DEST $line[0].$line[1];
$_=<DAT>;
print DEST;
}
}
}
}
close(DAT);
close(DEST);
I have a file (status.file) of the form:
valueA 3450
valueB -20
valueC -340
valueD 48
I am tailing a data.file, and need to search and modify a value
in status.file...the tail is:
tail -f data.file | awk '{ print $3, ($NF - $(NF-1)) }'
which will produce lines that look like this:
... (3 Replies)
I need only those records which has $2 equal to "DEF" independent of case (i.e upper or lower)
nawk -F"," '$2 ~ //{print $0}' file
This returns 3rd record also which i dont want
I tried this but this doesnt work as expected.
nawk -F"," '$2 == ""{print $0}' file
i dont... (3 Replies)
Hi,
I am new to unix shell programming.
I want to write a shell script for a functionality existing in mainframe system.
I have one file as below as input
123456
&__987
&12yuq
abcdef
_ referes to blank
condition:whenever the input file is having &__ ,it should be replaced... (4 Replies)
Hello,
I have File1 in a directory A, a File2 in a directory B.
If the File2 is not empty
Then I have to move File1 from directory A to a directory archive
Else no action.
Is it possible to do this from one command line?
Thank you in advance for your answers.
Madi (2 Replies)
Hi, Gurus,
I got a problem to resolve following issue:
I have one file file1as following:
start_dt=2010-01-01 12:00:02
start_dt=2011-01-01 09:00:02
start_dt=2009-01-01 11:00:02I have another file file2 as following:
title1, 2010-01-03 10:00:02
title2, 2011-01-04 11:00:02
title3,... (5 Replies)
Hi Sir,
I am just learning bash scripting and I came across a challenge.
I need to input F11 to a script among many text inputs.
For all the text inputs i did following.
# sh test.sh < input.txt
where input.txt contains all the text inputs in new lines.
This worked fine until i... (1 Reply)
Hi Folks,
I have the below feed file named abc1.txt in which you can see there is a title and below is the respective values in the rows and it is completely pipe delimited file ,.
... (3 Replies)
In the awk below I am trying to copy the entire contents of $6 there may be multiple values seperated by a ;, to $8, if $8 is . (lines 1 and 3 are examples). If that condition $8 is not . (line2 is an example) then that line is skipped and printed as is. The awk does execute but prints the output... (3 Replies)
Request your help to change the field color based on condition , if it is otherthan 0. using html in unix.
Here is my condition
for(i=1;i<=NF;i++)
{
print "<td> "$i"</td>
}
Please use CODE tags when displaying sample input, output, and code segments. (17 Replies)
In the awk below I am trying to add a | that will adjust $2 in the ouput by adding +1 if the original value from file that was used in $3 had a - in it. Line 3 of file is an example of this. In my current awk I just subtract one but I am not sure how to only apply this to those values without a -.... (5 Replies)
Discussion started by: cmccabe
5 Replies
LEARN ABOUT DEBIAN
requestbackport
requestbackport(1) General Commands Manual requestbackport(1)NAME
requestbackport - File a backport request bug
SYNOPSIS
requestbackport [options] package
DESCRIPTION
Determine the intermediate releases that package needs to be backported to, list all reverse-dependencies, and file the backporting
request. requestbackport will include a testing checklist in the bug.
OPTIONS -d DEST, --destination=DEST
Backport to DEST release and necessary intermediate releases. Default: current stable release.
-s SOURCE, --source=SOURCE
Backport from SOURCE release. Default: current development release.
-l INSTANCE, --lpinstance=INSTANCE
Launchpad instance to connect to. Default: production.
--no-conf
Don't read config files or environment variables
-h, --help
Display a help message and exit.
SEE ALSO backportpackage(1), reverse-depends(1).
AUTHORS
reverse-depends and this manpage were written by Stefano Rivera <stefanor@ubuntu.com>.
Both are released under the terms of the ISC License.
ubuntu-dev-tools November 2011 requestbackport(1)