Sponsored Content
Top Forums Shell Programming and Scripting How to find first match and last match in a file Post 302302766 by praving5 on Wednesday 1st of April 2009 12:46:32 AM
Old 04-01-2009
How to find first match and last match in a file

Hi All,
I have a below file:

==================
02:53 pravin-root
02:53 pravin-root
03:05 pravin-root
02:55 pravin1-root
02:59 pravin1-root
==================

How do I find the first and last value of column 1. For example, how do I find 02:53 is the first time stamp and 03:05 is the last time stamp for user "pravin-root"? The no. of users can be large.

I am trying a few options meanwhile... just posted here if someone already knows how to do it...

Thanks and regards,
Pravin Goyal
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find match in two diff file - local srv and remote server

Perl Guru.... I need to compare two diff file (file1.abc will locate in current server and file2.abc will locate in remote server), basically the script will look for match in both file and only will send out email if there is no match and also give me list of unmatch and dups as well. So... (0 Replies)
Discussion started by: amir07
0 Replies

2. Shell Programming and Scripting

Need help to grep for a title match and then make some queries after the match

Here is the sample of my file address.txt Address 1 1234 Drive way New Orleans, LA Zipcode :- 12345 Address 2 4567 Spring way Chicago, IL Zipcode :- 67890 I would like to grep for an Address title (Ex :- Address 2) , then get its zipcode and echo both in a single line. Ex :- ... (3 Replies)
Discussion started by: leo.maveriick
3 Replies

3. Shell Programming and Scripting

Match look up file and find result

Hi I ahve a lookup file wiht seven words CD HT CAD HT T1D T2D BDanother file contain data like this CHRM1 P11229 Pirenzepine DAP000492 Peptic ulcer disease Approved T2D CHRM1 P11229 Glycopyrrolate DAP001116 Anesthetic Approved T2D CHRM1 P11229 ... (7 Replies)
Discussion started by: manigrover
7 Replies

4. Shell Programming and Scripting

Match pattern1 in file, match pattern2, substitute value1 in line

not getting anywhere with this an xml file contains multiple clients set up with same tags, different values. I need to parse the file for client foo, and change the value of tag "64bit" from false to true. cat clients.xml <Client type"FIX"> <ClientName>foo</ClientName>... (3 Replies)
Discussion started by: jack.bauer
3 Replies

5. Shell Programming and Scripting

Compare two files and find match and print the header of the second file

Hi, I have two input files; file1 and file2. I compare them based on matched values in 1 column and print selected columns of the second file (file2). I got the result but the header was not printed. i want the header of file2 to be printed together with the result. Then i did below codes:- ... (3 Replies)
Discussion started by: redse171
3 Replies

6. Shell Programming and Scripting

Display match or no match and write a text file to a directory

The below bash connects to a site, downloads a file, searches that file based of user input - could be multiple (all that seems to work). What I am not able to figure out is how to display on the screen match found or no match found" and write a file to a directory (C:\Users\cmccabe\Desktop\wget)... (4 Replies)
Discussion started by: cmccabe
4 Replies

7. Shell Programming and Scripting

awk to update file based on partial match in field1 and exact match in field2

I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output. $1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies

8. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies

9. UNIX for Beginners Questions & Answers

Match file and find count

Hi All, I have transaction in one file.I want to match that to another file and find the number of time the transaction is available on the other file.I need to take each record from TRANSFILE and match that with SPEND FILE and find the number of counts of the transaction TRANSFILE: ... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

10. UNIX for Beginners Questions & Answers

Data match 2 files based on first 2 columns matching only and join if match

Hi, i have 2 files , the data i need to match is in masterfile and i need to pull out column 3 from master if column 1 and 2 match and output entire row to new file I have tried with join and awk and i keep getting blank outputs or same file is there an easier way than what i am... (4 Replies)
Discussion started by: axis88
4 Replies
volmgt_root(3VOLMGT)					Volume Management Library Functions				      volmgt_root(3VOLMGT)

NAME
volmgt_root - return the Volume Management root directory SYNOPSIS
cc [ flag ... ] file ... -lvolmgt [ library ... ] #include <volmgt.h> const char *volmgt_root(void); DESCRIPTION
The volmgt_root() function returns the current Volume Management root directory, which by default is /vol but can be configured to be in a different location. RETURN VALUES
The volmgt_root() function returns pointer to a static string containing the root directory for Volume Management. ERRORS
This function may fail if an open() of /dev/volctl fails. If this occurs a pointer to the default Volume Management root directory is returned. EXAMPLES
Example 1: Finding the Volume Management root directory. To find out where the Volume Management root directory is: if ((path = volmgt_root()) != NULL) { (void) printf("Volume Management root dir=%s ", path); } else { (void) printf("can't find Volume Management root dir "); } FILES
/vol default location for the Volume Management root directory ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
cc(1B), vold(1M), open(2), volmgt_check(3VOLMGT), volmgt_inuse(3VOLMGT), volmgt_running(3VOLMGT), attributes(5), volfs(7FS) NOTES
This function returns the default root directory location even when Volume Management is not running. SunOS 5.10 1 Feb 2001 volmgt_root(3VOLMGT)
All times are GMT -4. The time now is 08:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy