user28858585
user28858585

Reputation: 11

jq - difference in behavior between Linux and Windows version

Using jq 1.7 in Linux and Windows. The following run fine in Linux (version 5.10.228-219.884.amzn2.x86_64), but gives error "'.[]' is not recognized as an internal or external command, operable program or batch file" in Windows 11 command prompt or Powershell:

aws dms describe-replication-tasks --filter Name=replication-task-id,Values=TASKNAME --output json | jq '.ReplicationTasks | .[] | .TableMappings |= fromjson | .ReplicationTaskSettings |= fromjson | delpaths([ ["ReplicationTaskArn"],["ReplicationTaskStartDate"],["ReplicationTaskStats"],["Status"],["StopReason"],["ReplicationTaskCreationDate"],["ReplicationTaskSettings","Logging","CloudWatchLogGroup"],["ReplicationTaskSettings","Logging","CloudWatchLogStream"],["RecoveryCheckpoint"]]) | .TableMappings |= tostring |.ReplicationTaskSettings |= tostring' > TASKNAME.json

I've tried various tweaks, like replacing the ticks with quotes, but nothing seems to get this to run on Windows.

I expected the Windows command to produce the same output file as the Linux command did.

Upvotes: 0

Views: 74

Answers (1)

Charles Duffy
Charles Duffy

Reputation: 295696

Single quotes do not act as quoting characters in cmd.exe. Since you specify in the question that PowerShell is an option, use it -- your jq command works perfectly there.

Upvotes: 2

Related Questions