Search Results

Search: Posts Made By: buzzme
2,325
Posted By looney
awk ' NF && !/^ / { ...
awk '
NF && !/^ / {
ofile = $1
next
}
NF && /^ / {
print $1 >> ofile
close(ofile)
}
'...
2,325
Posted By cjcox
did you reallly replace the space-^I in those...
did you reallly replace the space-^I in those charset sequences with space-<tab key>?

It should work pretty much anywhere. Sp those char set sequences are either:

[<space><tab>]
or...
2,325
Posted By RudiC
Does it work to satisfaction as is? If yes, why...
Does it work to satisfaction as is? If yes, why incorporate it anywhere?

It checks for leading <TAB>s. If not found, use field as a file name. If found, print line into that file.
2,325
Posted By Yoda
Try this instead since it is <TAB> separated:- ...
Try this instead since it is <TAB> separated:-
awk -F'[\t ]' '
NF == 1 {
ofile = $1
next
}
NF == 2 {
print $2 > ofile
...
2,325
Posted By RudiC
Your file is <TAB> delimited, whic you didn't...
Your file is <TAB> delimited, whic you didn't specify nor include in your sample . Try this adaption of Yoda's script (and try it on a small subset of your data):awk '!/^ / {OFN=$1; next} {print >...
2,325
Posted By cjcox
Just for fun, place ^I with literal tab.... ...
Just for fun, place ^I with literal tab....


(sed -e '/^[ ^I]*$/d' -e '1s/^\([^ ^I].*\)/ cat >"\1" <<EOF/' -e '2,$s/^\([^ ^I].*\)/cat >"\1" <<EOF/' -e '/^cat/i\EOF' -e 's/^[ ^I]*//'...
2,325
Posted By Yoda
Did you check the working directory you ran this...
Did you check the working directory you ran this awk program and verified that there are no output files?

If there are no output files, can you run below command and post the output:-
od -c...
2,325
Posted By Yoda
awk ' NF && !/^ / { ...
awk '
NF && !/^ / {
ofile = $1
next
}
NF && /^ / {
print $1 >> ofile
close(ofile)
}
' input.txt
1,265
Posted By RudiC
How about awk '/cn=/ {getline X; if (!X) print} '...
How about awk '/cn=/ {getline X; if (!X) print} ' file
cn=steve
cn=rob
cn=matt
?

---------- Post updated at 22:44 ---------- Previous update was at 22:43 ----------

Or evenawk '/cn=/...
1,265
Posted By Don Cragun
Assuming that every segment in your file contains...
Assuming that every segment in your file contains a cn=name line, this might be a little bit simpler (and more portable) to get the output you said you wanted:
awk 'NF==1' RS= file
Modifying your...
1,265
Posted By cjcox
Just for fun: (cat file;echo "") | sed -n -e...
Just for fun:

(cat file;echo "") | sed -n -e '/^cn=/h;/^authtime=/{n;b};/^$/{x;p}'
1,354
Posted By Don Cragun
With all of the help you got on your last...
With all of the help you got on your last request: Need help for count using shell (https://www.unix.com/shell-programming-and-scripting/261834-need-help-count-using-shell.html), you must have a good...
1,354
Posted By Aia
[buzzme]$ awk '/yahoo\.com/ && NF==2 {print $1}'...
[buzzme]$ awk '/yahoo\.com/ && NF==2 {print $1}' RS= buzzme.file
user=alexander
user=paul
user=mike

[buzzme]$ awk '/yahoo\.com/ && NF>2 {print $1}' RS= buzzme.file
user=natasha
user=bipasha
...
1,354
Posted By Scrutinizer
Small variation: awk -F= 'NF==4 &&...
Small variation:
awk -F= 'NF==4 && $4=="yahoo.com"{print $2}' RS= file
alexander
paul
mike

The condition for using RS= (set the RS variable to an empty string) is that the separation between...
1,354
Posted By summer_cherry
users={} mark=[] with open("a.txt") as file: ...
users={}
mark=[]
with open("a.txt") as file:
for line in file:
line=line.replace("\n","")
if len(line)==0:
continue
if 'user=' in line:
user=line
else:
if user in users:...
Showing results 1 to 15 of 15

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