Sponsored Content
Full Discussion: Help me in this script fast
Top Forums Shell Programming and Scripting Help me in this script fast Post 302768902 by teefa on Sunday 10th of February 2013 12:36:01 PM
Old 02-10-2013
Help me in this script fast

i have log files that represent names, times and countries,
each name come once in country but may in diff times
i need at end each name visited which country and its [ last time of visit ]


Code:
USA | Tony | 12:25:22:431
Italy | Tony | 09:33:11:212    ****
Italy| John | 08:22:12:349 
France | Adam | 14:22:42:981
Italy | Tony | 08:22:42:212    ****
Italy | Tony | 04:22:42:212   ****
Italy | Tony | 18:22:42:212   ****
USA | Adam | 14:22:42:981

i want the output to be :

Code:
USA | Tony | 12:25:22:431
Italy | Tony | 18:22:42:212  / we discarded other as this is the latest time/ 
Italy| John | 08:22:12:349
France | Adam | 14:22:42:981
USA | Adam | 14:22:42:981

i have tired this code but it take very huge time so help me to get more smarter script or take a little time
Code:
while [1]
do 
for name in file.txt | cut -d/| -f2 | uniq -d 
do 
grep name file.txt | sort -n -k2  | tail -1 >> output.txt 
done 
done

but this script output is


Code:
Italy | Tony | 18:22:42:212   
Italy| John | 08:22:12:349
France | Adam | 14:22:42:981


which is wrong , it only get least day per name.

Last edited by Scrutinizer; 02-10-2013 at 04:16 PM.. Reason: code tags
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Need help fast

I am trying to reset the IP address on a Unix HP box here in my office and I am stuck in this EM100 mode and cant issue any commands. Any help would be great. By the way I no zero about unix. Thanks (0 Replies)
Discussion started by: zx6ninja
0 Replies

2. UNIX for Dummies Questions & Answers

What's the fast way to delete these files?

Hi, I had this request from user which I completed by using rm for all these files but I am wondering if there was way to finish it faster rather going through one file at a time. Please check attached text file to see file names. Thanks! (4 Replies)
Discussion started by: tonyvirk
4 Replies

3. Solaris

what is that 1 in the instruction!~ (please help fast)

Hi all, make_lofs /.cdrom/<something>/<something> 1 what does this instruction mean? Note:both the "something" are obviously different . I would like to know what that 1 means, the rest of the instruction is clear!! Thanks (6 Replies)
Discussion started by: wrapster
6 Replies

4. Shell Programming and Scripting

Performing fast searching operations with a bash script

Hi, Here is a tough requirement , to be served by bash script. I want to perform 3,00,000 * 10,000 searches. i.e. I have 10,000 doc files and 3,00,000 html files in the file-system. I want to check, which of the doc files are referred in any html files. (ex- <a href="abc.doc">abc</a>)... (3 Replies)
Discussion started by: jitendriya.dash
3 Replies

5. Solaris

How do you ufsrestore the fast way?

hi, on my sol9 box i create my backup using the below command: /usr/sbin/ufsdump 0uf /dev/rmt/0n /u1 /usr/sbin/ufsdump 0uf /dev/rmt/0n /u2 /usr/sbin/ufsdump 0uf /dev/rmt/0n /u3 /usr/sbin/ufsdump 0uf /dev/rmt/0n /u4 now on the new sol10 box, to restore i use this commands: cd /u1... (3 Replies)
Discussion started by: pinoy43v3r
3 Replies

6. Shell Programming and Scripting

Expect script exiting too fast if used without interact.

Hi I'm working on an Expect script that is supposed to log-into a remote server and run some steps and exit. In the script I first spawn a 'ssh' session to the server and then after logging in I 'send' all the necessary steps ( with a '\r' at the end, so that they get automatically executed the... (3 Replies)
Discussion started by: clakkad
3 Replies

7. Shell Programming and Scripting

Small fast question

just to confirm du from sh show sizes as multiples of 512 byte right? (4 Replies)
Discussion started by: Nick1097
4 Replies

8. UNIX for Dummies Questions & Answers

fast sequence extraction

Hi everyone, I have a large text file containing DNA sequences in fasta format as follows: >someseq GAACTTGAGATCCGGGGAGCAGTGGATCTC CACCAGCGGCCAGAACTGGTGCACCTCCAG GCCAGCCTCGTCCTGCGTGTC >another seq GGCATTTTTGTGTAATTTTTGGCTGGATGAGGT GACATTTTCATTACTACCATTTTGGAGTACA >seq3450... (4 Replies)
Discussion started by: Fahmida
4 Replies
LedgerSMB::DBObject::TaxForm(3pm)			User Contributed Perl Documentation			 LedgerSMB::DBObject::TaxForm(3pm)

NAME
LedgerSMB::DBObject::TaxFormm - Includes methods for saving and retrieving tax forms. SYNOPSIS
This module includes methods for saving and retrieving tax forms, and running reports. The tax forms are for reporting purchases or sales to tax bodies, and as of 1.3.0, the only tax forms officially included are those of the 1099-MISC and 1099-INT forms of the USA. Currently there is no abstraction layer to allow replacing the various reports on the fly, but this will have to be implemented in the future. METHODS
save Saves the tax form. Inputs are: form_name (required) The name of the form, eg, 1099-MISC country_id (required) The id of the country id (optional) The id of the tax form to overwrite In the future it is likely that we will add a taxform_sproc_id too as part of an abstraction layer. get($id) Retrieves information on the tax form specified and merges it with the current object. Properties set are: id ID of tax form form_name Name of tax form (eg, 1099-MISC) country_id ID of country attached to tax form get_full_list No inputs required. Provides a list of hashrefs (and attaches them to the form property of the object hashref). Each hashref has the same properties as are set by get($id) above, but also includes country_name which is the full name of the country (eg, 'United States'). Default ordering is by country name and then by tax form name. get_forms No inputs needed Returns a list of hashrefs representing tax forms. Each hashref contains the same properties as from get() above. Default ordering is by country id then tax form id. get_metadata Gets metadata for the screen. Sets the following hashref properties countries A list of all countries, for drop down box purposes. default_country The default country of the organization, to set the dropdown box. COPYRIGHT
Copyright (C) 2009 LedgerSMB Core Team. This file is licensed under the GNU General Public License version 2, or at your option any later version. Please see the included License.txt for details. perl v5.14.2 2012-03-25 LedgerSMB::DBObject::TaxForm(3pm)
All times are GMT -4. The time now is 12:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy