Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Grep

Name: Anonymous 2011-02-23 20:27

Help a fucking retarded winfag out with a stupid fucking dumbshit problem? Thanks.

TL;DR dumbfag trying to use grep in Cygwin and failing.

Goal: extract only words beginning with un- from a very large text file (or multiple files) and output all matches to a file. Needs to be only single words starting with un-, not whole lines where matches are found.

Problem: can't figure out how to pull out the whole word instead of just the "un." grep " un" gets me all the lines containing words starting with "un," but that's no use, and grep -o " un" is just going to return "un"s. How do?

Why I want to do it, in case you're interested:
I'm trying to do a bit of linguistics research by identifying "ungrammatical" constructions where the affix un- attaches to a noun base. This is generally considered ungrammatical by English speakers (e.g. *uncup, *unbook, *uncomputer), but there have been some notable exceptions and I'm looking to identify them in the works of certain authors historical and present. Since I'm working with a rare construction, there's no surefire way to filter out the non-noun parts of speech from my search, so I just have to sort through everything starting with un-.

Name: Anonymous 2011-02-23 20:56

>>2
>4chan
>bothered by swear words
>/prog/
>saging

This might be more to your liking:
I know the problem is one that should be easy to solve, and google is a very impressive resource indeed, but it seems I have no choice but to petition you fine gentlemen for assistance due to my inexperience in scripting-related matters.

Name: Anonymous 2011-02-23 21:29

>>4
I don't do high horse bullshit. I'd be fine with anon saying, "Please don't use such language, we're all sophisticated gentlemen here," if he dislikes the stylistics of my post. I'm not fine with the self-aggrandizing, autistic mentality behind, "lol i not help but i rite condescending poast so that internets know i cool kid who so indifferent to other people's expectations." My post addressed the board generally, not "village neckbeard 3."

Also, that won't work.

>>5
Not looking for that.

>>6
herpa derpa, pardon me for intruding upon the super secret treehouse meeting.

>>7
What is this doing? I understand the -io, but not the regular expressions stuff.
Thanks.

Name: Anonymous 2011-02-23 21:41

>>16
Oh, regular expressions aren't complicated at all. They're just generalizations of string characteristics. Is the + specifying that there should be at least one alphanumeric character in addition to "un"?

Name: Anonymous 2011-02-23 21:59

Ok, so one more question:

1) Does
grep -Eio '(\bun\w+)'
pick up every match, or just the first on every line?

Name: Anonymous 2011-02-23 22:00

>>21
Herpa derp, I originally had two questions and left the numbering.

Name: Anonymous 2011-02-23 22:05

>>23
I thought that was the case, but something in the grep man pages about file types made me unsure.

Thanks, all done.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List