Hello!
Is it anyone who might know how to extract the n last lines from a file, typically the 1000 last? Until know I have used sed -n np filename, but it takes each line separately, and is hence very time consuming.
Thank you in advance! (3 Replies)
Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2
file 1 sample
SNDK 80004C101 AT
XLNX 983919101 BB
NETL 64118B100 BS
AMD 007903107 CC
KLAC 482480100 DC
TER 880770102 KATS
ATHR 04743P108 KATS... (7 Replies)
Can anyone please help with this? I have 2 files as given below.
If 2nd column of file1 has pattern foo1@a, find the matching 1st column in file2 & replace 2nd column of file1 with file2's value.
file1
abc_1 foo1@a ....
abc_1 soo2@a ...
def_2 soo2@a ....
def_2 foo1@a ........ (7 Replies)
Hi Bigshots,
I have a pattern file with two columns. I have another data file. If column 1 in the pattern file appears as the 4th column in the data file, I need to replace it (4th column of data file) with column 2 of the pattern file. If the pattern is found in any other column, it should not... (6 Replies)
Hi,
I want to replace the value in more than one column.
For one column ,following command is working -
sed 's/./$value_to_replace/$column number' file_name
e.g. suppose this is input 1111000000
command - sed 's/./M/5'
output= 1111M000000
For two column also command is like -
cat... (22 Replies)
hi i have sample data
a,b,c,d,e,g h http://mysite.xyx
z,b,d,f,e,s t http://123124#
a,b,c,i,m,nothing
d,i,j,e,w,nothing
output expected is
a,b,c,d,e,http://mysite.xyx
z,b,d,f,e,http://123124#
a,b,c,i,m,nothing
d,i,j,e,w,nothing
i can get only links using grep -o 'http.*'
i... (8 Replies)
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (12 Replies)
I have a csv which has lot of columns . I was looking for an awk script which would extract a column twice. for the first occurance the header and data needs to be intact but for the second occurance i want to replace the header name since it a duplicate and extract year value which is in ddmmyy... (10 Replies)
file1:
Name,Threshold,Curr Samples,Curr Error%,Curr ART
GETHome,100,21601,0.00%,47
GETregistry,100,21592,0.00%,13
GEThomeLayout,100,30466,0.00%,17
file2:
Name,Threshold,Curr Samples,Curr Error%,Curr ART
GETHome,100,21601,0.00%,33
GETregistry,100,21592,0.00%,22... (6 Replies)
Discussion started by: Raghuram717
6 Replies
LEARN ABOUT DEBIAN
tk::optionmenu
Optionmenu(3pm) User Contributed Perl Documentation Optionmenu(3pm)NAME
Tk::Optionmenu - Let the user select one of some predefined options values
SYNOPSIS
use Tk::Optionmenu;
$opt = $w->Optionmenu(
-options => REFERENCE_to_OPTIONLIST,
-command => CALLBACK,
-variable => SCALAR_REF,
);
$opt->addOptions( OPTIONLIST );
# OPTION LIST is
# a) $val1, $val2, $val3,...
# b) [ $lab1=>$val1], [$lab2=>val2], ... ]
# c) combination of a) and b), e.g.,
# val1, [$lab2=>val2], val3, val4, [...], ...
DESCRIPTION
The Optionmenu widget allows the user chose between a given set of options.
If the user should be able to change the available option have a look at Tk::BrowseEntry.
OPTIONS -options
(Re)sets the list of options presented.
-command
Defines the callback that is invokes when a new option is selected.
-variable
Reference to a scalar that contains the current value of the selected option.
-textvariable
Reference to a scalar that contains the text label of the current value of the selected option.
METHODS
addOptions
Adds OPTION_LIST to the already available options.
EXAMPLE
use Tk;
my $mw = MainWindow->new();
my ($var, $tvar);
my $opt = $mw->Optionmenu(
-options => [[jan=>1], [feb=>2], [mar=>3], [apr=>4]],
-command => sub { print "got: ", shift, "
" },
-variable => $var,
-textvariable => $tvar
)->pack;
$opt->addOptions([may=>5],[jun=>6],[jul=>7],[aug=>8]);
my $f = $mw->Frame(-relief=>'groove', -borderwidth => 2)->pack;
$f->Label(-textvariable=>$tvar)->pack(-side => 'left');
$f->Label(-text => " -> ")->pack(-side => 'left');
$f->Label(-textvariable=>$var)->pack(-side => 'left');
$mw->Button(-text=>'Exit', -command=>sub{$mw->destroy})->pack;
MainLoop;
SEE ALSO
Tk::Menubutton, Tk::BrowseEntry
perl v5.14.2 2010-05-29 Optionmenu(3pm)