8 Krypton

Re: Isilon - (Script) - Run "du -hxcd1" against output

Thanks for the feedback! I think you got the quote marks right by copy-pasting.

Had to add another line to match a newer output format:

isi sync target list -v |

awk -F": " '

{ print $0; }

/^Target Dir:/ { printf "du: "; system("du -hxd1 \""$2"\""); }

/^ *Target Path:/ { printf "                        du: "; system("du -hxd1 \""$2"\""); }

'

The script simple adds a line tagged with "du:" after the Target Path line.

The path is repeated within the output from the du command.

sample output:

                      Name: TEST

                    Source: isi810

               Target Path: /ifs/data/target 1

                        du: 2.5K /ifs/data/target 1

            Last Job State: finished

                FOFB State: writes_disabled

       Source Cluster GUID: 000c2982a34602941c59a81c747b2bfa5644

Last Source Coordinator IP: 127.0.0.1

             Legacy Policy: No

               Last Update: 2017-08-16T11:22:16

(Note: the example target path contains a space in "target 1" to show that spaces in paths are handled correctly.

That's what those multiple quote marks are for...)

If even different output formats are found, please post a sample.

Cheers

-- Peter

0 Kudos