Search Results

Search: Posts Made By: dagamier
58,078
Posted By vgersh99
# $4 contains John awk '$4 ~ "John" {print $1,...
# $4 contains John
awk '$4 ~ "John" {print $1, $4}' myFile
# $4 is John
awk '$4 == "John" {print $1, $4}' myFile
2,401
Posted By CarloM
So, you could extract the allowed groups from...
So, you could extract the allowed groups from sshd.conf, and query LDAP to get the users in those groups.

On our systems this would be something like:
for group in $(awk '/AllowGroups/...
1,837
Posted By Aia
while IFS='|' read f1 f2 rest; do echo...
while IFS='|' read f1 f2 rest; do
echo "$f1|${f2%%.*}|$rest"
done < $1

prog.sh dataset.txt > saved_result.txt

Once that saved_result.txt is what you want, you can rename it.
1,837
Posted By RudiC
Try alsoawk '{sub(/\..*$/,"",$2)}1' FS=\| OFS=\|...
Try alsoawk '{sub(/\..*$/,"",$2)}1' FS=\| OFS=\| file
1,622
Posted By senhia83
Can you try this? I remember pulling this...
Can you try this?

I remember pulling this from the internet a long time ago, though never used it.

awk -vq='"' '
func csv2del(n) {
for(i=n; i<=c; i++)
{if(i%2 == 1) gsub(/,/, OFS,...
887
Posted By Corona688
Big problem #1: You are using "field 7" in the...
Big problem #1: You are using "field 7" in the 'NR==FNR' code block which gets run for file 1 only -- that file has no "field 7". All that code block should be doing is loading file 1, it knows...
2,013
Posted By RudiC
You should have transcribed above literally. Try...
You should have transcribed above literally. Try this (using "match..." as a pattern, not as part of the action):awk 'match ($1, /SUDO_GRP\([^)]*\)/) {MT=substr($1, RSTART, 8)
...
2,013
Posted By RudiC
Please show us what went wrong with your data....
Please show us what went wrong with your data. Would have been best to post a representative sample in the first place.

---------- Post updated at 20:48 ---------- Previous update was at 20:34...
2,013
Posted By MadeInGermany
The following seems to do what you describe. ...
The following seems to do what you describe.
The FS breaks the line into $1 $2 at the "(" and ")" ... in awk's main loop (surrounding white spaces allowed).
Then split() breaks $2 into A[1],...
2,129
Posted By Jotne
Using or in regex $9~/regex1|regex2|regex3|.../
Using or in regex
$9~/regex1|regex2|regex3|.../
5,291
Posted By Jotne
This should work. No need print, since print $0...
This should work. No need print, since print $0 is default action.
awk -F\| '$9 ~ /\/.*[0-9]+/' file1 > file2

The * here \/* makes / optional. 0 or more hits. Remove this.
Same here:...
2,129
Posted By Corona688
It will run through all your checks, potentially...
It will run through all your checks, potentially printing the same line several times, and the first condition with the "not" will not stop it.

If you want this to be an or-condition, you could...
2,129
Posted By Corona688
By default, if you don't put { ... } after an...
By default, if you don't put { ... } after an expression, it assumes it should do { print }.

If you do { next } instead, it will skip to the next line without printing and start checking your...
1,143
Posted By RudiC
awk -F: '$9 ~ /STC$/' file
awk -F: '$9 ~ /STC$/' file
5,916
Posted By Scrutinizer
Try: awk --posix -F\|...
Try:
awk --posix -F\| '$9~/\([a-z]-[a-z]{2}[0-9]{3}, [A-Z0-9]{2,3}\)|[A-Z0-9]{2,3}\/\/[a-z]-[a-z0-9]{4}/' infile
5,916
Posted By neutronscott
You'll probably have better success if you did...
You'll probably have better success if you did not store the regex as a string first. just use tolower($9) ~ /regex/. in fact the tolower isn't needed since you're not using any case sensitive...
5,916
Posted By Corona688
I see. No wonder you wanted to convert it :) ...
I see. No wonder you wanted to convert it :)

You can convert {2,3} to more regular syntax fortunately. Just put three of them, and make the third one optional with a ? after it. And repeat the...
Showing results 1 to 17 of 17

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