Sponsored Content
Top Forums Shell Programming and Scripting Grepping multiple strings from one column Post 302895371 by owwow14 on Monday 31st of March 2014 01:10:59 PM
Old 03-31-2014
[Solved] Grepping multiple strings from one column

I have 3-column tab separated data that looks like the following:

Code:
act of+n-a-large+vn-tell-v 0.067427
act_com of+n+n-a-large-manufacturer-n 0.129922
act-act_com-com in+n-j+vn-pass-aux-restate-v 0.364499666667
com nmod+n-j+ns-invader-n 0.527521
act_com-com obj+n-a-j+vd-contribute-v 0.091413
act on+ns+v-retreat-v 0.751588
act coord+ns-j+n-j-trash-n 0.751588
com obj+n-the+vn-pass-however-recreate-v 0.408118
act-com verb+ns-j+n-a-pull-n 0.3406765

I want to specifically grep the first column.
The possible combinations of the first column are the following:

Code:
act
com
act_com
act-act_com
act_com-com
act-act_com-com
act-com

I want to remove all of those lines that have the value 'act-com' in the first column.

What is the most efficient grep to do this?
I have tried

Code:
grep -w 'act\|com\|act_com\|act-act_com-com\|act-act_com\|act_com-com' input

However, it also considers 'act-com' as a valid string.
What should I do?

The desired output is the following:

Code:
act of+n-a-large+vn-tell-v 0.067427
act_com of+n+n-a-large-manufacturer-n 0.129922
act-act_com-com in+n-j+vn-pass-aux-restate-v 0.364499666667
com nmod+n-j+ns-invader-n 0.527521
act_com-com obj+n-a-j+vd-contribute-v 0.091413
act on+ns+v-retreat-v 0.751588
act coord+ns-j+n-j-trash-n 0.751588
com obj+n-the+vn-pass-however-recreate-v 0.408118

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grepping for strings

Hello. I have a dir of 1500+ dir. In these dirs is a file host, with a tag <x_tag>. I need to : 1. grep for all dir that contain this host file that contain <x_tag> 2. print a list of these host files containing <x_tag> is this better to egrep this? (5 Replies)
Discussion started by: t4st33@mac.com
5 Replies

2. Shell Programming and Scripting

Trouble grepping for multiple strings

I am having a heck of a time trying to write a script that will grep for multiple strings in a single file. I am really at my wits end here and I am hoping to get some feedback here. Basic information: OS: Solaris 9 Shell: KSH Oracle Database server I was trying to grep through a file... (5 Replies)
Discussion started by: thecoffeeguy
5 Replies

3. Shell Programming and Scripting

Grepping for Exact Strings

ok, apparently this is a very difficult question to answer based on my searches on google that came up fruitless. what i want to do is grep through a file for words that match a specified string. but the thing is, i keep getting all words in the file that have the string in them. say for... (27 Replies)
Discussion started by: SkySmart
27 Replies

4. Shell Programming and Scripting

Grepping for two strings that MUST exist on the same line

Trying to find a way to grep for two names on a line. Both names must appear on the same line so '|' / OR is out. So far, I'm just messing around and I've got find . -name "*" | xargs grep "Smith" Let me explain. I'm at a top level and need to know all the names of the files that... (6 Replies)
Discussion started by: Rally_Point
6 Replies

5. Shell Programming and Scripting

Grepping Multiple Strings on the Same Line 'Or'

I've got this command that I've been using to find strings on the same line, say I'm doing a search for name: find . -name "*" | xargs grep -i "Doe" | grep -i "John" > output.txt This gives me every line in a file that has John and Doe in it. I'm looking to add a OR operator for the second... (5 Replies)
Discussion started by: Rally_Point
5 Replies

6. UNIX for Dummies Questions & Answers

Grepping A Specific Column

Hello, I have a log file that outputs the data below. I would like to grep and display the data where column is equal '148.' I've searched the forum, and couldn't find any answers. I've tried all the grep switches and I get the same result as the log. I'm thinking I might have to use an... (4 Replies)
Discussion started by: ravzter
4 Replies

7. Programming

Grepping a column from multiple file

I have 20 files that look pretty much like this: 0.01 1 3822 4.97379915032e-14 4.96982253992e-09 0 0.01 3822 1 4.97379915032e-14 4.96982253992e-09 0 0.01 2 502 0.00993165137406 993.165137406 0 0.01 502 2 0.00993165137406 993.165137406 0 0.01 4 33 0.00189645523539 189.645523539 0 0.01 33 4... (5 Replies)
Discussion started by: kayak
5 Replies

8. Shell Programming and Scripting

Converting Single Column into Multiple rows, but with strings to specific tab column

Dear fellows, I need your help. I'm trying to write a script to convert a single column into multiple rows. But it need to recognize the beginning of the string and set it to its specific Column number. Each Line (loop) begins with digit (RANGE). At this moment it's kind of working, but it... (6 Replies)
Discussion started by: AK47
6 Replies

9. Shell Programming and Scripting

Grepping non-alpa-numerics from first column only

I have data in the following tab-separated format (consists of 200 columns all together, this is just a sampling) </s> 0.001701 0.002025 0.002264 0.001430 -0.001300 . -0.205240 0.177341 -0.426209 -0.661049 -0.048884 0.027032 the -0.159145 0.084377 0.056968 0.050934 0.160689 of -0.230698... (7 Replies)
Discussion started by: owwow14
7 Replies

10. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
XkbSASetScreen(3)						   XKB FUNCTIONS						 XkbSASetScreen(3)

NAME
XkbSASetScreen - Sets the screenXXX field of act from s SYNOPSIS
void XkbSASetScreen macro ( act, s ) XkbSwitchScreenAction act; int s; ARGUMENTS
- act action in which to set screenXXX - s value to set in screenXXX DESCRIPTION
Actions associated with the XkbSwitchScreen action structure change the active screen on a multiscreen display. The type field of the XkbSwitchScreenAction structure should always be XkbSA_SwitchScreen. The flags field is composed of the bitwise inclusive OR of the masks shown in Table 1. Table 1 Switch Screen Action Flags ------------------------------------------------------------------- Flag Meaning ------------------------------------------------------------------- XkbSA_SwitchAbsolute If set, the screenXXX field represents the index of the new screen. Otherwise, it represents an offset from the current screen to the new screen. XkbSA_SwitchApplication If not set, the action should switch to another screen on the same server. Oth- erwise, it should switch to another X server or application that shares the same physical display. The screenXXX field is a signed character value that represents either the relative or absolute screen index, depending on the state of the XkbSA_SwitchAbsolute bit in the flags field. Xkb provides the following macros to convert between the integer and signed character value for screen numbers in XkbSwitchScreenAction structures. STRUCTURES
typedef struct _XkbSwitchScreenAction { unsigned char type; /* XkbSA_SwitchScreen */ unsigned char flags; /* controls screen switching */ char screenXXX; /* screen number or delta */ } XkbSwitchScreenAction; NOTES
This action is optional. Servers are free to ignore the action or any of its flags if they do not support the requested behavior. If the action is ignored, it behaves like XkbSA_NoAction. Otherwise, key press and key release events do not generate an event. X Version 11 libX11 1.2.1 XkbSASetScreen(3)
All times are GMT -4. The time now is 04:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy