Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Grep to find matching patern and return unique values Post 302802115 by BhushanPathak on Friday 3rd of May 2013 02:13:30 AM
Old 05-03-2013
You have a file "saw_batch_drive_cmd", from which you want to get unique directories. Will the file contents be always similar to the sample one you have posted?

Try the following commands on the file -

Code:
cat saw_batch_drive_cmd | grep "/app/oracle" | cut -d"/" -f 1-5 | uniq | sed "s/^\#//"
/app/oracle/build_lib/pkg320.0_20120927
/app/oracle/build_lib/pkg320.0_20121004_prof
/app/oracle/build_lib/pkg320.0_20121004
/app/oracle/build_lib/pkg320.0_20121011
/app/oracle/build_lib/pkg330.0_20121011
/app/oracle/build_lib/pkg330.0_20121018

Let me know if this is what you were looking for.

Thanks
Bhushan Pathak

Last edited by BhushanPathak; 05-03-2013 at 03:17 AM.. Reason: updated the command, missed a pipe last time
This User Gave Thanks to BhushanPathak For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need to find only unique values for a given tag across the files

Need to find only unique values for a given tag across the files: For eg: Test1: <Tag1>aaa</Tag1> <Tag2>bbb</Tag2> <Tag3>ccc</Tag3> Test2: <Tag1>aaa</Tag1> <Tag2>ddd</Tag2> <Tag3>eee</Tag3> Test3: <Tag1>aaa</Tag1> <Tag2>ddd</Tag2> <Tag3>eee</Tag3> Test4: (8 Replies)
Discussion started by: sudheshnaiyer
8 Replies

2. Shell Programming and Scripting

return a list of unique values of a column from csv format file

Hi all, I have a huge csv file with the following format of data, Num SNPs, 549997 Total SNPs,555352 Num Samples, 157 SNP, SampleID, Allele1, Allele2 A001,AB1,A,A A002,AB1,A,A A003,AB1,A,A ... ... ... I would like to write out a list of unique SNP (column 1). Could you... (3 Replies)
Discussion started by: phoeberunner
3 Replies

3. UNIX and Linux Applications

grep file to find unique instances of username

hello - A SystemOut.log file has recurring entries that follow this format: Principal: auth9.nick.al.gov:389/USERNAME Over the course of a day thousands of lines similar to this are produced, with each username represented hundreds of times. I need to create a new file that shows... (4 Replies)
Discussion started by: 1075FJ40
4 Replies

4. Shell Programming and Scripting

Grep with regulare expression to find carrige return

Gurus, I have a files from where lines are like following <ns0:ccid>123456789</ns0:ccid> <ns0:ccid>1234 56789</ns0:ccid> I would like to grep any number which will be as below (with carrige return): As 123456789 any number so I have to use the regular expression <ns0:ccid>1234... (3 Replies)
Discussion started by: thepurple
3 Replies

5. Shell Programming and Scripting

Find and count unique date values in a file based on position

Hello, I need some sort of way to extract every date contained in a file, and count how many of those dates there are. Here are the specifics: The date format I'm looking for is mm/dd/yyyy I only need to look after line 45 in the file (that's where the data begins) The columns of... (2 Replies)
Discussion started by: ronan1219
2 Replies

6. UNIX for Dummies Questions & Answers

Grep to find lines matching given patern in a file

When I try with patern matching in a file with below code works cat scj_drive_commands | egrep '/app/oracle/build_lib/pkg32|/app/oracle/build_lib/pkg33' But when I have code with patern searching using of below does not work ! cat scj_drive_commands | egrep... (3 Replies)
Discussion started by: Siva SQL
3 Replies

7. Shell Programming and Scripting

How to find sum of any 'n' number of values from file matching target value?

I have a simple text file having payment amount value on each line. At the end of day 'n' number of payments created difference in amount that I need to match from this file. I have information about how many payments created difference and difference amount. Please help me to build shell... (3 Replies)
Discussion started by: swats007
3 Replies

8. Shell Programming and Scripting

Using grep and a parameter file to return unique values

Hello Everyone! I have updated the first post so that my intentions are easier to understand, and also attached sample files (post #18). I have over 500 text files in a directory. Over 1 GB of data. The data in those files is organised in lines: My intention is to return one line per... (23 Replies)
Discussion started by: clippertm
23 Replies

9. Shell Programming and Scripting

How to merge two files with unique values matching.?

I have one script as below: #!/bin/ksh Outputfile1="/home/OutputFile1.xls" Outputfile2="/home/OutputFile2.xls" InputFile1="/home/InputFile1.sql" InputFile2="/home/InputFile2.sql" echo "Select hobby, class, subject, sports, rollNumber from Student_Table" >> InputFile1 echo "Select rollNumber... (3 Replies)
Discussion started by: Sharma331
3 Replies

10. UNIX for Beginners Questions & Answers

Find unique values but only in column 1

Hi All, Does anyone have any suggestions/examples of how i could show only lines where the first field is not duplicated. If the first field is listed more than once it shouldnt be shown even if the other columns make it unique. Example file : 876,RIBDA,EC2 876,RIBDH,EX7 877,RIBDF,E28... (4 Replies)
Discussion started by: mutley2202
4 Replies
Mac::AETE::App(3)					User Contributed Perl Documentation					 Mac::AETE::App(3)

NAME
Mac::AETE::App - reads the Macintosh Apple event dictionary from an application. SYNOPSIS
use Mac::AETE::App; use Mac::AETE::Format::Dictionary; $app = App->new("My Application"); $formatter = Dictionary->new; $app->set_format($formatter); $app->read; $app->write; DESCRIPTION
The App module simplifies reading the Apple event dictionary from an application. It will launch the application if necessary to obtain the dictionary. Methods new Example: ($name is the name of the application.) use Mac::AETE::App; use Mac::AETE::Format::Dictionary; $app = App->new($aete_handle, $name); read (Inherited from Mac::AETE::Parser.) Reads the data contained in the AETE resource or handle. Example: $app->read; set_format (Inherited from Mac::AETE::Parser.) Sets the output formatter used during by the 'write' subroutine. Example: $formatter = Dictionary->new; $app->set_format($formatter); copy (Inherited from Mac::AETE::Parser.) Copies all suites from one Parser object into another. Example: $aete2 = Parser->new($aete_handle2, $another_name); $app->copy($aete2); copies the suites from $aete2 into $aete. merge (Inherited from Mac::AETE::Parser.) Merges suites from one Parser object into another. Only the suites that exist in both objects will be replaced. Example: $aete3 = Parser->new($aete_handle2, $another_name); $app->merge($aete3); write (Inherited from Mac::AETE::Parser.) Prints the contents of the AETE or AEUT resource using the current formatter. $app->write; INHERITANCE
Inherits from Mac::AETE::Parser. AUTHOR
David Schooley <dcschooley@mediaone.net> perl v5.10.0 2005-05-16 Mac::AETE::App(3)
All times are GMT -4. The time now is 11:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy