Search Results

Search: Posts Made By: dwdnet
10,294
Posted By Don Cragun
Hi dwdnet, Here is a copy of the script with...
Hi dwdnet,
Here is a copy of the script with comments explaining what each line of code is doing:
awk ' # Use awk to run the following script.
# Function called to add the terminating <newline> to...
10,294
Posted By Don Cragun
You could also try: awk ' function p() { ...
You could also try:
awk '
function p() {
if(d) {
print ""
d = s = 0
}
}
{ sub(/\r/, "")
}
/^timestamp=/ {
p()
}
NF { $1...
10,294
Posted By RudiC
How far would - except for the final semicolon -...
How far would - except for the final semicolon - bring you
awk '/^timestamp/ && NR > 1 {printf RS RS} 1' ORS=" " file
10,294
Posted By Don Cragun
Hi dwdnet, Instead of showing us the output you...
Hi dwdnet,
Instead of showing us the output you get from running the awk script provided in post #12 and labeling it "Sample Input", please show us the input that was given to that awk script. We...
10,294
Posted By MadeInGermany
I wonder if o = o (o == "" ? "" : " ") $0 ...
I wonder if
o = o (o == "" ? "" : " ") $0
is always correct.
We have a control variable d so let's use it. Becomes simpler and maybe fixes a problem, too.?
o = o (d ? " " : "") $0
10,294
Posted By Don Cragun
If the input is a text file, you don't care that...
If the input is a text file, you don't care that the output might not be a text file (due to line length limitations), can clearly describe the rules for combining input lines into output lines, and...
10,294
Posted By Don Cragun
You said originally that blank lines separate...
You said originally that blank lines separate records. From what you have said in post #15 it sounds like you have some blank lines in the middle of some records. It isn't clear how you want the...
10,294
Posted By MadeInGermany
I think the od dump is from your first awk's...
I think the od dump is from your first awk's output that was all on one line.
As Don said, the RS= will not see a \n\r\n but in GNU awk you can set RS="\n\r?\n" or even RS="\n[[:space:]]*\n" to...
10,294
Posted By RudiC
Hmmm - in the od output in post#8, I find many \r...
Hmmm - in the od output in post#8, I find many \r but just one \n. So my question... I only now see the three introductory bytes 357 273 277 - need to double check their meaning...
10,294
Posted By Don Cragun
We haven't seen enough information to determine...
We haven't seen enough information to determine whether or not there are <newline> (or <linefeed>) characters in the input file. Using RS= in awk to set the record separator to sequences of blank...
10,294
Posted By RudiC
You seem not to have any <line feed> chars in...
You seem not to have any <line feed> chars in your file except in the very end. So mayhap the condition you quoted in post#1 - empty line between records - can't be met with non- *nix files. Is that...
10,294
Posted By RudiC
Try awk 'gsub (";$|\r", "")+1 && $1=$1' RS=...
Try
awk 'gsub (";$|\r", "")+1 && $1=$1' RS= file
10,294
Posted By Don Cragun
One might guess that the file you are processing...
One might guess that the file you are processing has DOS line terminators (<carriage-return><newline>) instead of the expected UNIX line terminators (<newline>) and that the last line in your output...
10,294
Posted By RudiC
Thanks for pointing this out; I misread it in...
Thanks for pointing this out; I misread it in post#1. Try
awk 'sub (/;$/, "")+1 && $1=$1' RS= file
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application...
10,294
Posted By RavinderSingh13
Hello MadeInGermany, Nice code sir :b:. ...
Hello MadeInGermany,

Nice code sir :b:.


Hello dwdnet,

As you haven't shown the expected sample output, so based on your explanation of problem only, let me know if following helps...
10,294
Posted By RudiC
Try also awk 'gsub (/;/, "\t") && $1 = $1' RS=...
Try also
awk 'gsub (/;/, "\t") && $1 = $1' RS= file
timestamp=2017-06-28-01.01.35.080576 event status=0 userid=user1 authid=user1 application id=10.10.10.10.11111.12345678901 application...
10,294
Posted By MadeInGermany
With sed (multi-liner with comments) sed ' ...
With sed (multi-liner with comments)
sed '
#loop
:L
# last line? Then jump to E (leave the loop)
$bE
# append next line to the line buffer with \n in between
N
# empty line? Not then jump to...
Showing results 1 to 17 of 17

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