bash-string-manipulation-in-program-arguments.webp

Bash string manipulation in program arguments

In this code snippet, I would like to run an application with a URL payload based on date and time. This code will be executed in a specific schedule everyday and I would like to dynamically inject the date and time in the program argument when the program executes. ./json2csv rules.json "ncp" "http://localhost:8080/api/zget?eid=get-ncp-mv-by-starttime-endtime&starttime;=$(date --date='yesterday' +\%Y-\%m-\%d)+00:00:00&endtime;=$(date --date='yesterday' +\%Y-\%m-\%d)+23:59:00&container;=false" > $(echo "nercc_mv_$(date --date='yesterday' +\%Y-\%m-\%d).csv") The way to do this is using the Bash String Manipulation Inside a string, the bash will evaluate statement inside “$()” in this example: ...

December 27, 2025 · John Pili
use-linux-diff-command-for-line-by-line-comparison.webp

Use Linux diff command for line by line comparison

Use Linux diff command to compare files line by line. This handy tool helps you identify line differences between files and console output. Command diff -y file1 file1 Marker Meaning | = line present in both files but the text differs. < = line present only in the left file. > = line present only in the right file. Examples Comparing two package.json files johnpili@com ~ % diff -y package1.json package2.json { { "name": "date-diff", | "name": "time-zones", "version": "0.0.0", "version": "0.0.0", "scripts": { "scripts": { "ng": "ng", "ng": "ng", "start": "ng serve", "start": "ng serve", "build": "ng build --base-href /tools/date-diff/ --config | "build": "ng build", "watch": "ng build --watch --configuration development", "watch": "ng build --watch --configuration development", "test": "ng test" "test": "ng test" }, }, "private": true, "private": true, "dependencies": { "dependencies": { "@angular/common": "^19.2.0", "@angular/common": "^19.2.0", "@angular/compiler": "^19.2.0", "@angular/compiler": "^19.2.0", "@angular/core": "^19.2.0", "@angular/core": "^19.2.0", "@angular/forms": "^19.2.0", "@angular/forms": "^19.2.0", "@angular/platform-browser": "^19.2.0", "@angular/platform-browser": "^19.2.0", "@angular/platform-browser-dynamic": "^19.2.0", "@angular/platform-browser-dynamic": "^19.2.0", "@angular/router": "^19.2.0", "@angular/router": "^19.2.0", "@tailwindcss/postcss": "^4.1.4", "@tailwindcss/postcss": "^4.1.4", "daisyui": "^5.0.28", "daisyui": "^5.0.28", "moment": "^2.30.1", | "moment-timezone": "^0.5.48", "postcss": "^8.5.3", "postcss": "^8.5.3", "rxjs": "~7.8.0", "rxjs": "~7.8.0", "tailwindcss": "^4.1.4", "tailwindcss": "^4.1.4", "tslib": "^2.3.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" "zone.js": "~0.15.0" }, }, "devDependencies": { "devDependencies": { "@angular-devkit/build-angular": "^19.2.8", "@angular-devkit/build-angular": "^19.2.8", "@angular/cli": "^19.2.8", "@angular/cli": "^19.2.8", "@angular/compiler-cli": "^19.2.0", "@angular/compiler-cli": "^19.2.0", "@types/jasmine": "~5.1.0", "@types/jasmine": "~5.1.0", "jasmine-core": "~5.6.0", "jasmine-core": "~5.6.0", "karma": "~6.4.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.2.0", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "karma-jasmine-html-reporter": "~2.1.0", "typescript": "~5.7.2" "typescript": "~5.7.2" } } } } johnpili@com ~ % The example below shows how to use diff to compare installed PHP modules. This is very useful when you’re switching to a different version of PHP ...

October 19, 2025 · John Pili