Search Results

Search: Posts Made By: sudon't
1,667
Posted By elixir_sinari
/\(.\)\1/!d : For all lines not matching the...
/\(.\)\1/!d :
For all lines not matching the pattern, delete the pattern space. The ! is for the pattern and not for the action d. This means that for all lines not having at least 1 consecutive...
1,667
Posted By alister
To find words that have at least one double but...
To find words that have at least one double but not more than 3:

sed -n -e '/\(.\)\1/!d; s//&/4; t' -e p

The number can be parameterized with a shell variable.

Regards,
Alister
3,428
Posted By bakunin
To be honest, i dislike perl: IMHO it is like a...
To be honest, i dislike perl: IMHO it is like a Swiss Army pocket knife: 756 functions - and not one of them in a usable shape.*)

My suggestion is to do it with simple shell commands. UNIX is...
3,428
Posted By elixir_sinari
You've badly messed up the command line and the...
You've badly messed up the command line and the logic.

Try:
perl -i.old -ne 'print unless m:^\s*<string>com\.apple\.PhotoBooth</string>\s*$:' ~/Library/Compositions/Compound\ Eye.qtz

I...
2,512
Posted By RudiC
Anchoring them at line end is a good idea - I had...
Anchoring them at line end is a good idea - I had no chance to test it so missed that...
Try also the "abbreviated" pattern ".*f(.{1,2}|.{3}d)$"
2,512
Posted By RudiC
As you said, you can have "f" and two letters...
As you said, you can have "f" and two letters following, or, "f" and three letters and "d".
Why not use two ored regexs: grep -E ".*f.{1,2}|.*f.{3}d"?
32,230
Posted By alister
Without -v: grep '^[^aeiou]*$' twl Regards, ...
Without -v:
grep '^[^aeiou]*$' twl
Regards,
Alister
32,230
Posted By MadeInGermany
Read them like this: grep lines without a...
Read them like this:

grep lines without a 'vowel'

grep lines with a 'non-vowel'
1,346
Posted By bakunin
Frankly, i haven't ever used FreeBSD either. In...
Frankly, i haven't ever used FreeBSD either. In fact, machines which occupy less than 1m³ of space are not to my liking.



Actually, no. We want "ruby1.9" to be reachable also via "ruby", so we...
3,435
Posted By Corona688
It's usually a good idea to leave your originals...
It's usually a good idea to leave your originals untouched if at all possible. I don't even like automatic renaming. I prefer to use originals as a template, and create new files. That way, if you...
3,435
Posted By Yoda
The contents of a field, as seen by awk, can be...
The contents of a field, as seen by awk, can be changed within an awk program; this changes what awk perceives as the current input record. The actual input is untouched; awk never modifies the input...
3,435
Posted By Yoda
This should definitely work!! awk '!arr[$0]++'...
This should definitely work!!
awk '!arr[$0]++' ~/path/to/file.txt > ~/path/to/newfile.txt
Please double check and verify if you are missing something.
3,435
Posted By Corona688
$0 means 'the entire unmodified line', pure and...
$0 means 'the entire unmodified line', pure and simple. You can change what 'line' means to awk, but by default, it uses newlines like everything else.

You can think of it as a hash table if you...
3,435
Posted By jim mcnamara
Look up associative array: Associative array -...
Look up associative array: Associative array - Wikipedia, the free encyclopedia (http://en.wikipedia.org/wiki/Associative_array)
3,435
Posted By Corona688
I'd be more worried if you had, as it's not a...
I'd be more worried if you had, as it's not a regex. It's more like C than anything.

It's an array with a string as the index. It checks if it's zero, then adds to it. The first time the index...
3,435
Posted By rdcwayx
see the explanation: ...
see the explanation:
https://www.unix.com/302678079-post2.html
3,435
Posted By Yoda
awk '!arr[$0]++' wordlist_file
awk '!arr[$0]++' wordlist_file
3,409
Posted By bakunin
The reason is that bash (and any other shell i...
The reason is that bash (and any other shell i know of) is bothering to even look in $PWD - unlike DOS/Windows, which did (and this way spoiled people). "bash" looks exclusively along the PATH...
3,409
Posted By alister
On linux and BSD systems (perhaps other Unices as...
On linux and BSD systems (perhaps other Unices as well), system calls are documented in section 2 and library functions in section 3 of the manual pages.

Builtins typically refer to shell...
3,409
Posted By alister
The open() system call, which is used to open a...
The open() system call, which is used to open a file for reading/writing, supports relative paths. When the path to the file does not contain any slashes, it is designed to look in the current...
3,409
Posted By Corona688
You're missing the point. If you just type...
You're missing the point. If you just type 'mycommand' and hit enter, you won't run something that's been maliciously dumped in a local directory by accident.

You can still do so with ./ but it...
3,409
Posted By bakunin
In fact it is: directories where (system)...
In fact it is: directories where (system) binaries are stored, like "/usr/bin", are writable only for root (and probably for a very select group of other system users). This means that only root can...
7,638
Posted By bakunin
Not quite. "fi" is indeed "if" spelled backwards...
Not quite. "fi" is indeed "if" spelled backwards (you will later learn a construct called "case" which ends with "esac") and it ends only the fi-clause, nothing else. Cosider the following...
7,638
Posted By bakunin
Yes, absolutely. There are a very few occasions...
Yes, absolutely. There are a very few occasions where not quoting has some desired effect and it not done. In the overwhelming majority of cases quoting has no bad effect at all and probably/perhaps...
7,638
Posted By bakunin
Of course there is nothing wrong with using...
Of course there is nothing wrong with using "find" - but there are a few points I'd like to highlight. (Just between us experts - there are more ways to skin a cat, isn't it? ;-))

if [[ ! -d...
Showing results 1 to 25 of 46

 
All times are GMT -4. The time now is 09:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy