replacing a placeholder in a html file with 1-n specific values defined in a config.json using shellscript [closed]

we cannot use any 3rd party tools which are not usually present on systems Given that we don’t know what “systems” you’re using, this isn’t a very useful restriction to tell us about. Perl has several JSON parsers available and since Perl 5.14 (which was released in May 2011) one of them (JSON::PP) has been … Read more

file validation in linux scripting

If you want to do it in pure bash, use the following script: #!/bin/bash while read line; do line=( ${line//[:]/ } ) for i in “${!line[@]}”; do [ ! -z “${line[$i]##*[!0-9]*}” ] && printf “integer” || printf “string” [ “$i” -ne $(( ${#line[@]} – 1)) ] && printf “:” || echo done done < $1 … Read more

Iterating through a CSV and pulling out the last line of the day for each element

You can also consider using groupby If your data is already in this format: [ [‘CZ’, ’12/27/07 3:55 PM’, ‘1198788900’, ‘42345’, ‘42346’,], [‘CZ’, ’12/27/07 5:30 PM’, ‘1198794600’, ‘42346’, ‘42300’,], [‘CZ’, ’12/27/07 7:05 PM’,’1198800300′, ‘42300’, ‘42000’,], [‘JB’, ’12/27/07 7:05 PM’,’1198800300′, ‘13722’, ‘13500’,], [‘I’, ’12/27/07 7:05 PM’, ‘1198800300’, ‘4475’, ‘4572’] ] Then you can do this: #truncate … Read more

Some troubles with using sed and awk [closed]

From what we can discern of this question, you’re attempting to create a programmatic rule to rename files ending in extensions stdout-captured, stderr-captured, and status-captured (assuming one typo) into files ending in extensions stdout-expected, stderr-expected, and status-expected, respectively. Obviously, if each of these definitions is inclusive of exactly one file, a rote mv may be … Read more