Dear All,
Good day. Here i am facing some problem like below.
file contains
12345 0001 090112
14385 0001 090112
13255 0001 090112
11345 0001 090112
....
I want to sort ascending according to the first column. What will be the shell script. (4 Replies)
Hi,
My input file is
$cat samp
1 siva
1 raja
2 siva
1 siva
2 raja
4 venkat
i want sort this name wise...alos need to remove duplicate lines.
i am using
cat samp|awk '{print $2,$1}'|sort -u
it showing
raja 1 (3 Replies)
Hello,
I've done
ls -ls >fileout1
When I do the sort command for +4 it sorts it bu group. When I do +5 it sorts it by date. But it's skipping the file size column. Example:
rwxr-xr-x 1 Grueben sup 65 16 Sep 13:58 cdee
How can I sort it by file size? It doesn't... (2 Replies)
I now have a 230,000+ lines long text file formatted in segments like this:
Is there a way to sort this file to have everything in chronological order, based on the date and time in the text? In this example, I would like the result to be: (19 Replies)
Hello ,
i have a text file like this
1 a1 ,AB ,AC ;AD ,EE
2 a2 ,WE ;TR ,YT ,WW
3 a3 ;AS ,UY ;RF ,YT
i want to sort this text file based on each row , and excluding 2nd column from the sorting and not taking the comma or ; into consideration in the sorting, so it will become like this... (12 Replies)
Hi Gurus,
I have file content sample:
,5113955056,,TAgent-Suspend
,5119418233,,TAgent-Suspend
,5102119078,,TAgent-Suspend
filenames 120229H5_suspend, 120229H6_unsuspend
I receive those files one of directory /home/temp/
I need following:
1. Backup first /home/temp/ file to... (5 Replies)
Hi,
I am trying to get the file in particular pattern using shell script. I have to add one column to some other file.
For example consider two file as below.
File1:
name1
name2
name3
File2:
Add1 age1
Add2 age2
Add3 age3
I want this two file in a single file format something like... (3 Replies)
Hello,
I need help on.
I have a File which stores the information as below.
It is space separated file, I want to keep only unique record in file based on file name.
Also if you notice sometime filename with space appear in last column like (abc_ xyz1_bc12_20140312_c.xlsx)
03/17/2014 ... (9 Replies)
I am new to shell scripting. I am interested how to know how to sort a content of a file using shell scripting.
I've attached the 'Input file' and the 'expected output' to this thread.
Details provided in the expected output file will provide details on how the sort needs to be done.
... (16 Replies)
I have the below contents in a file after making the below curl call
curl ... | grep -E "state|Rno" | paste -sd',\n' | grep "Disconnected" > test
"state" : "Disconnected",, "Rno" : "5554f1d2"
"state" : "Disconnected",, "Rno" : "10587563"
"state" : "Disconnected",, "Rno" :... (2 Replies)
Discussion started by: Vaibhav H
2 Replies
LEARN ABOUT DEBIAN
app::cmd::simple
App::Cmd::Simple(3pm) User Contributed Perl Documentation App::Cmd::Simple(3pm)NAME
App::Cmd::Simple - a helper for building one-command App::Cmd applications
VERSION
version 0.318
SYNOPSIS
in simplecmd:
use YourApp::Cmd;
Your::Cmd->run;
in YourApp/Cmd.pm:
package YourApp::Cmd;
use base qw(App::Cmd::Simple);
sub opt_spec {
return (
[ "blortex|X", "use the blortex algorithm" ],
[ "recheck|r", "recheck all results" ],
);
}
sub validate_args {
my ($self, $opt, $args) = @_;
# no args allowed but options!
$self->usage_error("No args allowed") if @$args;
}
sub execute {
my ($self, $opt, $args) = @_;
my $result = $opt->{blortex} ? blortex() : blort();
recheck($result) if $opt->{recheck};
print $result;
}
and, finally, at the command line:
knight!rjbs$ simplecmd --recheck
All blorts successful.
SUBCLASSING
When writing a subclass of App::Cmd:Simple, there are only a few methods that you might want to implement. They behave just like the same-
named methods in App::Cmd.
opt_spec
This method should be overridden to provide option specifications. (This is list of arguments passed to "describe_options" from
Getopt::Long::Descriptive, after the first.)
If not overridden, it returns an empty list.
validate_args
$cmd->validate_args(\%opt, @args);
This method is passed a hashref of command line options (as processed by Getopt::Long::Descriptive) and an arrayref of leftover arguments.
It may throw an exception (preferably by calling "usage_error") if they are invalid, or it may do nothing to allow processing to continue.
execute
Your::App::Cmd::Simple->execute(\%opt, @args);
This method does whatever it is the command should do! It is passed a hash reference of the parsed command-line options and an array
reference of left over arguments.
WARNINGS
This should be considered experimental! Although it is probably not going to change much, don't build your business model around it yet,
okay?
App::Cmd::Simple is not rich in black magic, but it does do some somewhat gnarly things to make an App::Cmd::Simple look as much like an
App::Cmd::Command as possible. This means that you can't deviate too much from the sort of thing shown in the synopsis as you might like.
If you're doing something other than writing a fairly simple command, and you want to screw around with the App::Cmd-iness of your program,
Simple might not be the best choice.
One specific warning... if you are writing a program with the App::Cmd::Simple class embedded in it, you must call import on the class.
That's how things work. You can just do this:
YourApp::Cmd->import->run;
AUTHOR
Ricardo Signes <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-05-05 App::Cmd::Simple(3pm)