Sponsored Content
Top Forums Shell Programming and Scripting Help with finding a string and printing value in the next column Post 302379715 by drewpark on Friday 11th of December 2009 03:49:36 PM
Old 12-11-2009
Help with finding a string and printing value in the next column

Hi, been about 10 years since I've scripted, so very rusty and could use some quick help.

I have a file that contains data like such:

folder1 jondoe owner janedoe reader joeshmo none
folder2 jondoe none janedoe none joeshmo owner
folder3 jondoe owner
folder4 janedoe owner joeshmo reader

Want to search for janedoe for each line of the file and print the next column. So, expecting output like:

folder1 janedoe reader
folder2 janedoe none
folder 4 janedoe owner

Much thanks in advance.
Drew
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Printing highest value from one column

Hi, I have a file that looks like this: s6 98 s6 91 s6 56 s5 32 s5 10 s5 4 So what I want to do is print only the highest value for each value in the column: So the file will look like this: s6 98 s5 32 Thanks (4 Replies)
Discussion started by: phil_heath
4 Replies

2. UNIX for Dummies Questions & Answers

creating a file using the fist column and printing second column

Hello all. I have a problem that I need help solving. I would like to convert the following file: human pool1_12 10e-02 45 67 human pool1_1899 10e-01 45 29 human pool1_1829 10e-01 43 26 horse pool1_343 10e-20 65 191 horse pool1_454 10e-09 44 43... (5 Replies)
Discussion started by: viralnerd
5 Replies

3. Shell Programming and Scripting

Help finding a field value then printing line

Hello, I'm trying to only print out the file systems that are greater than 90% full. So far I've got: df -k >sawky8 cat sawky8 | grep -v Filesystem | sed "s/%//g;" >sawky9 cat sawky9 | awk '{print $4}' | read stot print $stot if ;then echo $LINE Problem is it stops after the first... (2 Replies)
Discussion started by: Grueben
2 Replies

4. Shell Programming and Scripting

grep on string and printing line after until another string has been found

Hello Everyone, I just started scripting this week. I have no background in programming or scripting. I'm working on a script to grep for a variable in a log file Heres what the log file looks like. The x's are all random clutter xxxxxxxxxxxxxxxxxxxxx START: xxxxxxxxxxxx... (7 Replies)
Discussion started by: rxc23816
7 Replies

5. UNIX for Dummies Questions & Answers

Printing a particular column using SED

Hi, i want to display only the particular column using SED command. For example, ps -ef|grep ash |sed -n '1p'|cut -d ' ' -f2   this gives 29067 ps -ef|grep ash |sed -n '1p'|awk '{print $2}'    this also gives the same  in the same way i need the solution using sed. Please... (4 Replies)
Discussion started by: pandeesh
4 Replies

6. Shell Programming and Scripting

Reformatting single column text file starting new line when finding particular string

Hi, I have a single colum file and I need to reformat the file so that it creates a new line every time it come to an IP address and the following lines are corresponding rows until it comes to the next IP address. I want to turn this 172.xx.xx.xx gwpusprdrp02_pv seinwnprd03... (7 Replies)
Discussion started by: kieranfoley
7 Replies

7. Shell Programming and Scripting

Printing second column of several files into one

HI All, I have exactly 100 text files with extension .txt. The files contain numbers like this: 1.txt 0.4599994 65914 0.40706193 190743 0.39977244 185019 0.39831382 74906 0.3915928 122428 0.38844505 39999 0.38820446 72691 0.38787442 176430 0.38670844 28791 0.38597047 91091... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

8. UNIX for Dummies Questions & Answers

Printing out lines that have the same value in the first column but different value in the second

Hi, I have a text file that looks like the following: ILMN_1343291 6 74341083 74341772 ILMN_1343291 6 74341195 74341099 ILMN_1343295 12 6387581 6387650 ILMN_1651209 1 1657001 1657050 ILMN_1651209 5 83524260 83524309 I... (1 Reply)
Discussion started by: evelibertine
1 Replies

9. Shell Programming and Scripting

Inconsistent column printing

Hi, I have a file that has inconsistently numbered columns. Like row1 has 23 columns, and row 2 has 34 columns etc. I would like to re-order the first 8 columns as required and from the 9th column till the end, I would like to print it as it is. I tried to read the re-ordered 8 columns... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

10. Shell Programming and Scripting

Printing most frequent string in column

I am trying to put together an script that will output the most frequent string in a column. This is what I have: awk '{count++} END {for ( i in count ) print i, count }' Of course, my script is outputting all different strings and counts. However, I just need the most frequent one (there... (7 Replies)
Discussion started by: Xterra
7 Replies
XSetSelectionOwner(3X11)					     MIT X11R4						  XSetSelectionOwner(3X11)

Name
       XSetSelectionOwner, XGetSelectionOwner, XConvertSelection - manipulate window selection

Syntax
       XSetSelectionOwner(display, selection, owner, time)
	  Display *display;
	  Atom selection;
	  Window owner;
	  Time time;

       Window XGetSelectionOwner(display, selection)
	  Display *display;
	  Atom selection;

       XConvertSelection(display, selection, target, property, requestor, time)
	  Display *display;
	  Atom selection, target;
	  Atom property;
	  Window requestor;
	  Time time;

Arguments
       display	 Specifies the connection to the X server.

       owner	 Specifies the owner of the specified selection atom.  You can pass a window or

       property  Specifies the property name.  You also can pass

       requestor Specifies the requestor.

       selection Specifies the selection atom.

       target	 Specifies the target atom.

       time	 Specifies the time.  You can pass either a timestamp or

Description
       The function changes the owner and last-change time for the specified selection and has no effect if the specified time is earlier than the
       current last-change time of the specified selection or is later than the current X server time.	Otherwise, the last-change time is set to
       the specified time, with replaced by the current server time.  If the owner window is specified as then the owner of the selection becomes
       (that is, no owner).  Otherwise, the owner of the selection becomes the client executing the request.

       If the new owner (whether a client or is not the same as the current owner of the selection and the current owner is not the current owner
       is sent a event.  If the client that is the owner of a selection is later terminated (that is, its connection is closed) or if the owner
       window it has specified in the request is later destroyed, the owner of the selection automatically reverts to but the last-change time is
       not affected.  The selection atom is uninterpreted by the X server.  returns the owner window, which is reported in and events.	Selections
       are global to the X server.

       can generate and errors.

       The function returns the window ID associated with the window that currently owns the specified selection.  If no selection was specified,
       the function returns the constant If is returned, there is no owner for the selection.

       can generate a error.

       requests that the specified selection be converted to the specified target type:

       o    If the specified selection has an owner, the X server sends a event to that owner.

       o    If no owner for the specified selection exists, the X server generates a event to the requestor with property

       The arguments are passed on unchanged in either of the events.  There are two predefined selection atoms: PRIMARY and SECONDARY.

       can generate and errors.

Diagnostics
       A value for an Atom argument does not name a defined Atom.

       A value for a Window argument does not name a defined Window.

See Also
       X Window System: The Complete Reference, Second Edition, Robert W. Scheifler and James Gettys

															  XSetSelectionOwner(3X11)
All times are GMT -4. The time now is 04:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy