Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
awk -F '[[:space:]][[:space:]]+' '[teal]{[/teal] [b]split[/b][teal]([/teal][navy]$12[/navy][teal],[/teal] m[teal],[/teal] [fuchsia]/[[:space:]]/[/fuchsia][teal]);[/teal] [b]print[/b] [navy]$1[/navy][teal],[/teal] [navy]$7[/navy][i][green]"/"[/green][/i][navy]$6[/navy][teal],[/teal] m[teal][[/teal][purple]1[/purple][teal]],[/teal] m[teal][[/teal][purple]2[/purple][teal]],[/teal] m[teal][[/teal][purple]3[/purple][teal]] }[/teal]'
awk -F '\\s\\s+' '[teal]{[/teal] [b]print[/b] [navy]$1[/navy][teal],[/teal] [navy]$7[/navy][i][green]"/"[/green][/i][navy]$6[/navy][teal],[/teal] [COLOR=orange]gensub[/color][teal]([/teal][fuchsia]/(\S+\s\S+\s\S+).*/[/fuchsia][teal],[/teal] [i][green]"[/green][/i][lime]\\[/lime][i][green]1"[/green][/i][teal],[/teal] [i][green]""[/green][/i][teal],[/teal] [navy]$12[/navy][teal]) }[/teal]'
[gray]# or[/gray]
awk -F '\\s\\s+' '[teal]{[/teal] [b]match[/b][teal]([/teal][navy]$12[/navy][teal],[/teal] [fuchsia]/\S+\s\S+\s\S+/[/fuchsia][teal],[/teal] m[teal]);[/teal] [b]print[/b] [navy]$1[/navy][teal],[/teal] [navy]$7[/navy][i][green]"/"[/green][/i][navy]$6[/navy][teal],[/teal] m[teal][[/teal][purple]0[/purple][teal]] }[/teal]'
awk -F '[[:space:]][[:space:]]+' '[teal]{[/teal] [b]match[/b][teal]([/teal][navy]$12[/navy][teal],[/teal] [fuchsia]/[^[:space:]]+[[:space:]][^[:space:]]+[[:space:]][^[:space:]]+/[/fuchsia][teal]);[/teal] [b]print[/b] [navy]$1[/navy][teal],[/teal] [navy]$7[/navy][i][green]"/"[/green][/i][navy]$6[/navy][teal],[/teal] [b]substr[/b][teal]([/teal][navy]$12[/navy][teal],[/teal] RSTART[teal],[/teal] RLENGTH[teal]) }[/teal]'
Sorry to hear that. Could you post some sample input and expected output ? And specify which Awk implementation / version are you using.Joe said:didn't work....
9145091880251509 Completed w/Exception(s) 10010 2015-12-23 20:00 EST 00h:59m:07s 2015-12-23 20:59 EST Scheduled Backup 6.2 TB 0.1% yyy.com /xxxx Windows Server 2008 R2 Enterprise Server Edition (No Service Pack) 64-bit 7.0.102-47 2015-12-23 20:00 EST 2015-12-24 08:00 EST 00h:00m:36s /xxxx/Windows 2008 Windows File System Retention_xxxx D xxxx Windows /xxxx/Windows_2008 xxxx Windows-Windows 2008-1450918802270 Avamar N/A
9145091880251709 Completed w/Exception(s) 10010 2015-12-23 20:59 EST 00h:05m:19s 2015-12-23 21:05 EST Scheduled Backup 42.8 GB 0.8% yyyy.com /xxxx Windows Server 2008 R2 Enterprise Server Edition (No Service Pack) 64-bit 7.0.102-47 2015-12-23 20:00 EST 2015-12-24 08:00 EST 00h:59m:45s /xxxx/Windows 2008 Windows VSS Retention_xxxx D xxxx Windows /xxxx/Windows_2008 xxxx Windows-Windows 2008-1450918802270 Avamar N/A
9145083240268209 Completed w/Exception(s) 10010 2015-12-22 22:11 EST 00h:48m:34s 2015-12-22 23:00 EST Scheduled Backup 6.2 TB 0.1% yyyy.com /xxxx Windows Server 2008 R2 Enterprise Server Edition (No Service Pack) 64-bit 7.0.102-47 2015-12-22 20:00 EST 2015-12-23 08:00 EST 02h:11m:46s /xxxx/Windows 2008 Windows File System Retention_xxxx D xxxx Windows /xxxx/Windows_2008 xxxx Windows-Windows 2008-1450832402416 Avamar N/A
... yyy.com /xxxx[highlight red] [/highlight]Windows Server 2008 ...
... yyyy.com /xxxx[highlight green] [/highlight]Windows Server 2008 ...
... yyyy.com /xxxx[highlight green] [/highlight]Windows Server 2008 ...
perl -ne '[b]print[/b][i][green]"$1 $3/$2 $4\n"[/green][/i][b]if[/b][i][green]/^(.+?)\s+\d+\s+\d{4}-\d{2}-\d{2}.+?\s(\w+\.\w+)\s+(\/\w+).+\s{2,}\/\w+\/.+?\s{2,}(.+)\s+Retention/[/green][/i]'
<Row>
<ID>9145117800006709</ID>
<Status>Completed</Status>
<ErrorCode>0</ErrorCode>
<StartTime>2015-12-26 20:11 EST</StartTime>
<Elapsed>00h:07m:05s</Elapsed>
<EndTime>2015-12-26 20:18 EST</EndTime>
<Type>Scheduled Backup</Type>
<ProgressBytes>22.7 GB</ProgressBytes>
<NewBytes>0.9%</NewBytes>
<Client>mickey.mouse.com</Client>
<Domain>/Unrestrictive/Infrastructure</Domain>
<OS>Windows Server 2008 R2 Enterprise Server Edition Service Pack 1 64-bit</OS>
<ClientRelease>7.1.101-145</ClientRelease>
<Sched.StartTime>2015-12-26 20:00 EST</Sched.StartTime>
<Sched.EndTime>2015-12-27 08:00 EST</Sched.EndTime>
<ElapsedWait>00h:11m:21s</ElapsedWait>
<Group>/Infrastructure-ServerFile-S20-RD30</Group>
<Plug-In>Windows VSS</Plug-In>
<RetentionPolicy>RD30</RetentionPolicy>
<Retention>D</Retention>
<Schedule>S20</Schedule>
<Dataset>/ServerFile</Dataset>
<WID>S20-Infrastructure-ServerFile-S20-RD30-1451178000029</WID>
<Server>Avamar</Server>
<Container>N/A</Container>
</Row>
May I suggest another off-topic solution for that ? XMLStarlet :Joe said:All I really need is to strip out all the tags and put the data on one line separated by a comma
xmlstarlet sel -t -m //Row -v ID -o , -v Status -o , -v Errorcode -o , -v Domain -o / -v Client -o , -v Plug-In -n
raw-quickc () {
export MCCLI=/usr/local/avamar/bin/mccli
export BIN=/home/admin/bin
echo "ID,Status,ErrorCode,StartTime,Elapsed,EndTime,Type,ProgressBytes,NewBytes,Client,Domain,OS,ClientRelease,Sched.StartTime,Sched.EndTime,ElapsedWait,Group,Plug-In,RetentionPolicy,Retention,Schedule,Dataset,WID,Server,Container"
$MCCLI activity show --completed=true --verbose --xml | sed -n '/<Row/,/<\/Row/p'| sed 's/<\/\?[^>]\+>//g'|awk '{$1=$1}1'|awk -f $BIN/ONE_Line.awk|sed 's/\&\;lt\;//g'
}
BEGIN { RS = ""; FS = "\n"; ORS = "" }
{
x=1
while ( x<NF ) {
print $x ","
x++
}
print $NF "\n"
}