Sponsored Content
Special Forums Windows & DOS: Issues & Discussions win2008R2 using gnu grep/awk to find only the I instance out of the command Post 302662467 by nextreme on Tuesday 26th of June 2012 03:10:17 PM
Old 06-26-2012
doesn't work, but here's more

Ok, so the first command gives me this:
Code:
0  B  06/11/2012 13:55:09             STANDARD             A  \\virttsm\f$\db001
 0  B  06/11/2012 16:08:16             STANDARD             A  \\virttsm\f$\FILES
 0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES
 0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES1
 0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES2
 0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES3
 0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES4
 0  B  06/11/2012 13:55:09             STANDARD             A  \\virttsm\f$\db001\SERVER1
 0  B  06/11/2012 13:55:09             DEFAULT              A  \\virttsm\f$\db001\SERVER1\SQLCRT.FLG
 0  B  06/11/2012 16:08:16             DEFAULT              A  \\virttsm\f$\FILES\dsmc
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (10)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (11)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (12)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (13)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (14)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (15)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (16)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (17)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (18)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (19)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (2)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (20)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (21)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (3)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (4)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (5)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (6)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (7)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (8)
 0  B  06/11/2012 13:03:39             DEFAULT              A  \\virttsm\f$\FILES\file_1888 - Copy (9)

Then what i need with the additional awk parameters is the following:
Code:
0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES1
0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES2
0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES3
0  B  06/11/2012 13:03:39             STANDARD             I  \\virttsm\f$\FILES4
etc


Last edited by nextreme; 06-26-2012 at 04:21 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find command with Grep

I need to find for a particular string in my /opt file system. find . -exec grep "10000" {} \; I tried this command, it works ok but I want not to search in the logs folder I have in my filesystem as it takes lot of time. SO can I exclude one or more than on directory or sub directories from... (10 Replies)
Discussion started by: venu_nbk
10 Replies

2. UNIX for Dummies Questions & Answers

grep, find or awk?

Since I found this very helpful forum and friendly people, I have a small request. I use AIX Unix and would like to know if there's a simple way how to do a kind of compare between two files. Should I use some grep, find or awk? I have 2 text files, let's name them file1 and file2. What I... (4 Replies)
Discussion started by: netrom
4 Replies

3. UNIX for Dummies Questions & Answers

| help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax

Hello, I'm working on unix with grep (GNU grep) 2.5.1. I'm going through some of the newer regex syntax using Regular Expression Reference - Advanced Syntax a guide. ls -aLl /bin | grep "\(x\)" Which works, just highlights 'x' where ever, when ever. I'm trying to to get (?:) to work but... (4 Replies)
Discussion started by: MykC
4 Replies

4. Shell Programming and Scripting

awk - find first instance of string after NR==10

How do I use awk to find the NR of first instance of a specific string after eg NR==10? I need to find the first instance of the word "class" after a specific NR. (2 Replies)
Discussion started by: locoroco
2 Replies

5. Shell Programming and Scripting

How to use grep & find command to find references to a particular file

Hi all , I'm new to unix I have a checked project , there exists a file called xxx.config . now my task is to find all the files in the checked out project which references to this xxx.config file. how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies

6. Shell Programming and Scripting

grep second instance of same string

Hi all, i am new to unix scripting in ksh or any shell for that matter. I have downloaded a xml file from a website and saved on my local harddrive. inside the xml, the same tag is listed multiple times. <title>Tonight</title> <title>Thursday</title> <title>Friday</title>... (6 Replies)
Discussion started by: scubasteve39
6 Replies

7. Shell Programming and Scripting

grep for a string until instance of a space

Hey guys, I'm having a bit of trouble getting this to work using either sed or grep. It's possible awk might be the ticket I need as well, but my regulat expression skills aren't quite up to the task for doing this. I'm looking to grep for the string ERROR from the following log up until any... (6 Replies)
Discussion started by: terrell
6 Replies

8. Shell Programming and Scripting

How can I just grep one instance of a word in the file

I want to grep some information out of the dmidecode but when I type dmidecode | grep Memory I get several instances of the word. Is there a way I can just choose which instance I want to display? (8 Replies)
Discussion started by: jcnewton13
8 Replies

9. UNIX for Advanced & Expert Users

Grep the only instance name

Hi, I want to get the only application name from the server. Ex: if i give $ ps -ef | grep bw. It will show all BW process with entire path. It will little confuse to list out the process. Can anyone have syntax to get only the instance name. I need this for be, hawk,ems also. Please... (2 Replies)
Discussion started by: ckchelladurai
2 Replies

10. Shell Programming and Scripting

One instance of comparing grep and awk

Hi. In thread https://www.unix.com/shell-programming-and-scripting/267833-grouping-counting.html rovf and I had a mini-discussion on grep and awk. Here is a demo script that compares the awk and grep approaches for this single problem: #!/usr/bin/env bash # @(#) s2 Demonstrate group... (1 Reply)
Discussion started by: drl
1 Replies
All times are GMT -4. The time now is 12:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy