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

Pages: 1-4041-

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:51

fuck fag fuck shit fag
Yeah, this is someone I really care to help.

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:04

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

Who are you quoting (is that even a quote?), >>2 never said such things!
Also, sage your posts and don't use /b/speak, only retarded use it.
>>1
$ grep 'un' files ...
You can go back to /b/ or /g/, now.

Name: Anonymous 2011-02-23 21:04

^un
Lines starting with un.

Name: Anonymous 2011-02-23 21:07

>>3
>4chan
Maybe you should go back there.

Name: Anonymous 2011-02-23 21:07

grep -Eio '(\bun\w+)'

Name: 7 2011-02-23 21:09

>>2,4,6
Fuck off, ``faggot''. Too busy to choke on nigger cocks to help, aren't you?

Name: Anonymous 2011-02-23 21:13

>>8
Why faggot in quotation marks?

Are you ``retarded''?

Name: Anonymous 2011-02-23 21:13

>>8
Too busy not getting the /b/ scum leak inside /prog/? Yes.

Name: Anonymous 2011-02-23 21:16

>>10
Hah, I'd rather have him around than cock-sucking faggot elitist ``LISPPERS'' like you.

Name: Anonymous 2011-02-23 21:19

>>11
Then you may want to go back to /code.

Name: Anonymous 2011-02-23 21:21

>>12
Why don't you go somewhere else? It would certainly make this a better board. This place is highly un4chanish.

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:30

>>13
Why don't you go somewhere else? It would certainly make this a better board. This place is highly 4chanish since you came.

Name: Anonymous 2011-02-23 21:32

>>14
-E activates extended grep.
-i and -o you already know.
\b means word boundary.
\w means alphanumeric. (see the grep manual breathing page)
something+ means ``at least one occurrence of something

Cheers

Name: Anonymous 2011-02-23 21:34

>>8,9,10,11,12,13
Do you guys just sit around and troll each other all day as a general hobby?

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:43

>>17
We used to, but since >>13 decided to act like an imageboard retard, it's just an endless succession of ``noko'' and ``go back to /b/''.

Optimize your quotes: >>8-13

Name: Anonymous 2011-02-23 21:46

>>18
Is the + specifying that there should be at least one alphanumeric character in addition to "un"?
Yes, it will match ``una'', ``undefined'', but not ``un''. If you want to match zero or more character after ``un'', use \w* instead of \w+.

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:02

>>21
Every match. You could confirm this easily on your own.

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.

Name: Anonymous 2011-02-23 22:06

>>24
Awesome. Does that mean you will stop bumping this thread now?

Name: Anonymous 2011-02-23 22:06

>>24
You're welcome :)

Name: Anonymous 2011-02-23 22:06

>>21
Every match in the file(s).
grep -Eio '(bunw+)' file
grep -Eio '(bunw+)' file files ...

>>22
Herpa derp
Seriously, don't speak like that here, we don't like it, they will mark you as ``imageboard retard'' and will not help.

Name: Anonymous 2011-02-23 22:07

>>25
Look at the other threads on the front page. Then back at this thread. Then at the other threads. Then back to this thread.

Name: Anonymous 2011-02-23 22:10

>>27
Blubbity, blub bleab blib blab bleb, bleh bloh blaib blib, bleyh bleeh blab bloo blas ``I am a cock sucking textboard autist'' blab blib blob bleb.

Name: Anonymous 2011-02-23 22:11

>>28
The only salient difference is that some of the other threads are about programming. And their authors don't respond to each and every troll. Bump bump bump!

Name: Anonymous 2011-02-23 22:11

>>28
It's sad because you're right.

Name: Anonymous 2011-02-23 22:12

>>29
Ungrateful piece of shit.

Name: Anonymous 2011-02-23 22:14

>>32
I'm not OP, I'm the ``faggot'' guy.

Name: Anonymous 2011-02-23 22:18

>>33
Oh well carry on then I guess. You ungrateful piece of shit, you.

Name: Anonymous 2011-02-23 22:19

>>33
At least you admit you're a faggot.

Name: Anonymous 2011-02-23 22:21

>>35
Man I wish either of you had at least grade school level reading comprehension.

Name: Anonymous 2011-02-23 22:22

>>33
nice dubz bro.

Name: Anonymous 2011-02-23 22:30

OP here, came back because I figured the trawling would continue. I'm
>>1,3,14,18,21,22,24
and that's it.

Stop trolling yourselves. No more posts from me.

Name: Anonymous 2011-02-23 22:33

>>38
Trolling is breathing to us.

Name: Anonymous 2011-02-24 0:23

>>39
Trolling is now breathing manually.

Name: Anonymous 2011-02-24 1:07

>>40
I hate you.

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