Search Results

Search: Posts Made By: Samingla
3,315
Posted By Don Cragun
You would make your life easier if you didn't put...
You would make your life easier if you didn't put spaces in filenames (like File 2), the filename fiel1 looks like a typo, and your output show lines matching cn=xyz, but the corresponding line in...
3,315
Posted By Don Cragun
Try this: awk -F '[ ,]' ' FNR == NR { ...
Try this:
awk -F '[ ,]' '
FNR == NR {
cn[tolower($1)]
next
}
$1 == "dn:" {
copy = (tolower($2) in cn)
}
copy { print ($1 == "userPassword::" ? $0 : tolower($0))
}' File1 File2
1,697
Posted By anbu23
awk 'BEGIN{FS=OFS=","}...
awk 'BEGIN{FS=OFS=","} /cn=/{uid=substr($1,index($1,"=")+1)}
/cn=|uid/{sub(uid,tolower(uid),$1)} 1 ' input.txt
1,697
Posted By RavinderSingh13
Hello, Following may also help. ...
Hello,

Following may also help.


awk -F"\:|\," '/cn/ {$2=tolower($2); OFS=","}; /uid\:/ {$2=tolower($2);OFS=":"} 1' check_lower_case


Output will be as follows.


Input:
dn,...
3,131
Posted By Yoda
Here is an awk approach that will work for posted...
Here is an awk approach that will work for posted data:
awk '
NR == FNR {
A[$2]
next
}
$2 in A {
f = 1
...
3,131
Posted By Yoda
Use /usr/xpg4/bin/awk or nawk instead of awk on...
Use /usr/xpg4/bin/awk or nawk instead of awk on Solaris/SunOS
3,198
Posted By vgersh99
/^uid:/ && toupper($2) in f2 {f++}
/^uid:/ && toupper($2) in f2 {f++}
3,387
Posted By danmero
awk -F'[ =,]'...
awk -F'[ =,]' '/^dn:/{x=$3;y=$0;next}/^mail:/{sub(x,$NF,y);$0=y ORS$0}1' file
3,387
Posted By DGPickett
You can read each block into the buffer in sed...
You can read each block into the buffer in sed and move strings around:
sed '
:loop
$b sub
/\n$/b sub
N
b loop
:sub
s/^dn: aa=[^@]*\(@.*\nmail: \([^@]*\)@\)/dn:aa=\2\1/
'...
3,387
Posted By Scrutinizer
Hi, see if this works for you : awk...
Hi, see if this works for you :
awk '{sub(/aa=[^,]*/,"aa="$4)}1' RS= ORS='\n\n' infile
(on Solaris use /usr/xpg4/bin/awk)
3,861
Posted By Franklin52
Give this a try: nawk -F"[ ,]"...
Give this a try:
nawk -F"[ ,]" 'NR==FNR{a[toupper($1$2)]=$4 OFS $5; next}
{idx=toupper($1$2)}
idx in a {u=a[idx]}
u && /uid:/{$0=$0 RS u; u=""}
1' id_list.txt attributes.txt > out
2,714
Posted By vgersh99
As noted in the other thread of yours.. awk...
As noted in the other thread of yours..
awk 'NR==FNR{a[$1" "$2]=$4" "$5}NR>FNR{if(length(a[x])>0) {print NF?$0: a[x]"\n""object class: trs\n"} else {print $0};if(/^cn:/) x=toupper($0)}' FS="[, ]"...
2,714
Posted By yinyuemi
Hi Sam, you can try: awk '...
Hi Sam,


you can try:

awk ' BEGIN{IGNORECASE=1}other codes'

hope it works,

Best,

Y
2,714
Posted By yinyuemi
awk 'NR==FNR{a[$1" "$2]=$4" "$5}NR>FNR{print...
awk 'NR==FNR{a[$1" "$2]=$4" "$5}NR>FNR{print NF?$0:a[x]"\n";if(/^cn:/) x=$0}' FS="[, ]" file2 file1
2,714
Posted By yinyuemi
awk 'NR==FNR{a[$1" "$2]=$4" "$5}NR>FNR{print...
awk 'NR==FNR{a[$1" "$2]=$4" "$5}NR>FNR{print NF?$0:a[x]"\n""object class: trs\n";if(/^cn:/) x=$0}' FS="[, ]" file2 file1
1,985
Posted By vgersh99
nawk -f sam.awk myFile sam.awk: BEGIN {...
nawk -f sam.awk myFile

sam.awk:

BEGIN {
RS=FS=""
}
{
uid=0
for (i=1;i<=NF;i++) {
if($i ~ "^uid:" && ++uid>1) continue
printf("%s%c%c", $i, ORS, (i==NF)?ORS:"")
}
}
1,985
Posted By rdcwayx
awk '/^dn:/{s=0} /^uid:/{if (s==0) {s++} else...
awk '/^dn:/{s=0} /^uid:/{if (s==0) {s++} else {next}}1' Example.txt
Showing results 1 to 17 of 17

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