03-09-2009
Quote:
Originally Posted by
tanit
Hi Experts.
I need to list the file and the filename comes from the file ListOfFile.txt.
Basicly I have a filename "ListOfFile.txt" and it contain
Example of ListOfFile.txt
/home/Dave/Program/Tran1.P
/home/Dave/Program/Tran2.P
/home/Dave/Program/Tran3.P
/home/Dave/Program/Tran4.P
/home/Dave/Program/Tran5.P
Each file contain the same format on the first 2 lines about it's version.
I need to read the data from thesecond line column 3
Example of Tran1.P
/****************************
01122008 /home/Dave/Program/Tran1.P 10.05
****************************/
After I get the data from second line column 3 (10.05), I need to compare this data to the same filename that I found from file mapVersion.txt
Example of mapVersion.txt
Tran001.P|3.4
Tran020.P|4.2
Tran1.P|10.05
Tran12.P|4.11
Tran2.P|3.0
Tran3.P|10.5
Tran3A.P|12.3
Tran4.P|4.1
Tran5.P|1.2
I want to know if it's the same or not.
The same as
what?
Quote:
Originally Posted by tanit
I know how to write script with ksh but I like to use awk to do this because I think it's faster than while loop.
Why?
Last edited by vgersh99; 03-09-2009 at 11:56 AM..
Reason: remove code - misread the question - see radoulov's code
10 More Discussions You Might Find Interesting
1. AIX
Hi,
I am trying to find the content of file using grep and find command and list only the file names
but i am getting entire file list of files in the directory
find . -exec grep "test" {} \; -ls
Can anyone of you correct this (2 Replies)
Discussion started by: madhu_Jagarapu
2 Replies
2. Shell Programming and Scripting
Hi,
I have two files with the format shown below. I need to read first field(value before comma) from file 1 and search for a record in file 2 that has the same value in the field "KEY=" and write the complete record of file 2 with corresponding field 2 of the first file in to result file.
... (11 Replies)
Discussion started by: King Kalyan
11 Replies
3. Shell Programming and Scripting
help me pls.. :(
i want to read a mapping file.
Below is the content of my mapping file.
6221,189,SMSC1,OMC1,WAP1
6223,188,SMSC2,OMC2,WAP2
so when my program running
msisdn="622130302310"
while not EOF
if substring($msisdn,1,4) == "6221" -- > "6221" read from the file
then
echo... (0 Replies)
Discussion started by: voidmain
0 Replies
4. Shell Programming and Scripting
Hello ,
I have huge file with below content. I need to read the numeric values with in the paranthesis after = sign. Please help me with awk and sed script for it.
11.10.2009 04:02:47 Customer login not found: identifier=(0748502889) prefix=(TEL) serviceCode=().
11.10.2009 04:03:12... (13 Replies)
Discussion started by: rmv
13 Replies
5. Shell Programming and Scripting
i have one file
abhi.txt
its contents are
home8/mc09ats/UnixCw/backup/file1
home8/mc09ats/file2
i want to read this content of file using while loop..
in this i want to seperate the content as follows
path=home8/mc09ats/UnixCw/backup
file=file1
echo path
echo file
can you... (1 Reply)
Discussion started by: AbhijitIT
1 Replies
6. Shell Programming and Scripting
Hi -
I have a file containing data like :-
cn=tommy,cn=users,c=uk
passwordexpirydate=20100530130623z
cn=jane,cn=users,c=uk
passwordexpirydate=20100423140734z
cn=michael,cn=users,c=uk
passwordexpirydate=20100331020044z
I want to end up with a file that looks like:-... (6 Replies)
Discussion started by: sniper57
6 Replies
7. Shell Programming and Scripting
Hi,
I am working on one script..I am having files in the below format
file 1 (each line is separated with : delimeter)
SPLASH:SPLASH:SVN
CIB/MCH:MCH:SVN
Now I want from file 1 that most left part of the first line will store in... (6 Replies)
Discussion started by: rohit22hamirpur
6 Replies
8. Shell Programming and Scripting
hi all,
i had the below script
x=`cat input.txt |wc -1`
awk 'NR>1 && NR<'$x' ' input.txt > output.txt
by using above script i am able to remove the head and tail part from the input file and able to append the output to the output.txt but if i run it for second time the output is... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies
9. Shell Programming and Scripting
Hi all,
i need a bash script.
I have a 3 file named Milano, Torino, Firenze
Into file i have:
Milano
Marco
Luca
Giorgio
Michele
PatrizioTorino
Marco
Giulio
Emilio
MicheleFirenze
Luca
Giorgio
Marco
Saverio
EmilioThe output should be a all_city.csv file like: (3 Replies)
Discussion started by: kamose
3 Replies
10. Shell Programming and Scripting
I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix.
I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice.
Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
LEARN ABOUT DEBIAN
mojo::command
Mojo::Command(3pm) User Contributed Perl Documentation Mojo::Command(3pm)
NAME
Mojo::Command - Command base class
SYNOPSIS
# Lower case command name
package Mojolicious::Command::mycommand;
# Subclass
use Mojo::Base 'Mojo::Command';
# Take care of command line options
use Getopt::Long 'GetOptions';
# Short description
has description => "My first Mojo command.
";
# Short usage message
has usage => <<"EOF";
usage: $0 mycommand [OPTIONS]
These options are available:
-s, --something Does something.
EOF
# <suitable Futurama quote here>
sub run {
my $self = shift;
# Handle options
local @ARGV = @_;
GetOptions('s|something' => sub { $something = 1 });
# Magic here! :)
}
DESCRIPTION
Mojo::Command is an abstract base class for Mojo commands.
See Mojolicious::Commands for a list of commands that are available by default.
ATTRIBUTES
Mojo::Command implements the following attributes.
"description"
my $description = $command->description;
$command = $command->description('Foo!');
Short description of command, used for the command list.
"quiet"
my $quiet = $command->quiet;
$command = $command->quiet(1);
Limited command output.
"usage"
my $usage = $command->usage;
$command = $command->usage('Foo!');
Usage information for command, used for the help screen.
METHODS
Mojo::Command inherits all methods from Mojo::Base and implements the following new ones.
"app"
my $app = $command->app;
Currently active application.
# Introspect
say "Template path: $_" for @{$command->app->renderer->paths};
"chmod_file"
$command = $command->chmod_file('/home/sri/foo.txt', 0644);
Portably change mode of a file.
"chmod_rel_file"
$command = $command->chmod_rel_file('foo/foo.txt', 0644);
Portably change mode of a file relative to the current working directory.
"class_to_file"
my $file = $command->class_to_file('Foo::Bar');
Convert a class name to a file.
Foo::Bar -> foo_bar
FOO::Bar -> foobar
FooBar -> foo_bar
FOOBar -> foobar
"class_to_path"
my $path = $command->class_to_path('Foo::Bar');
Convert class name to path.
Foo::Bar -> Foo/Bar.pm
"create_dir"
$command = $command->create_dir('/home/sri/foo/bar');
Portably create a directory.
"create_rel_dir"
$command = $command->create_rel_dir('foo/bar/baz');
Portably create a directory relative to the current working directory.
"get_all_data"
my $all = $command->get_all_data;
my $all = $command->get_all_data('Some::Class');
Extract all embedded files from the "DATA" section of a class.
"get_data"
my $data = $command->get_data('foo_bar');
my $data = $command->get_data('foo_bar', 'Some::Class');
Extract embedded file from the "DATA" section of a class.
"help"
$command->help;
Print usage information for command.
"rel_dir"
my $path = $command->rel_dir('foo/bar');
Portably generate an absolute path for a directory relative to the current working directory.
"rel_file"
my $path = $command->rel_file('foo/bar.txt');
Portably generate an absolute path for a file relative to the current working directory.
"render_data"
my $data = $command->render_data('foo_bar', @args);
Render a template from the "DATA" section of the command class.
"render_to_file"
$command = $command->render_to_file('foo_bar', '/home/sri/foo.txt');
Render a template from the "DATA" section of the command class to a file.
"render_to_rel_file"
$command = $command->render_to_rel_file('foo_bar', 'foo/bar.txt');
Portably render a template from the "DATA" section of the command class to a file relative to the current working directory.
"run"
$command->run;
$command->run(@ARGV);
Run command. Meant to be overloaded in a subclass.
"write_file"
$command = $command->write_file('/home/sri/foo.txt', 'Hello World!');
Portably write text to a file.
"write_rel_file"
$command = $command->write_rel_file('foo/bar.txt', 'Hello World!');
Portably write text to a file relative to the current working directory.
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 Mojo::Command(3pm)