[Solved] Error in shell script and how to write to a file [closed]

I think this question is fine now, the input file is good enough after edit, I can fully understand what you ask for now. With awk, you need learn to use 2-d array, it will simplify the code. awk ‘BEGIN{print “Instance id Name Owner Cost.centre”} /TAG/{split($0,a,FS);a[4]=tolower(a[4]);$1=$2=$3=$4=””;b[a[3],a[4]]=$0;c[a[3]]} END{for (i in c) printf “%-18s%-26s%-14s%-20s\n”,i,b[i,”name”],b[i,”owner”],b[i,”cost.center”]}’ file Instance id … Read more

[Solved] how do I basic script with linux? [closed]

#!/bin/bash is called the shebang (you missed the leading #). It tells which program will execute your script. clear is for clearing screen. echo outputs following argument to the standard output (your terminal by default). But you must not surround your string with parenthesis as it’s used for grouping command in a sub-shell. If you … Read more

[Solved] Create directory structure in unix [closed]

current_year=$(date +%Y) next_month=$(($(date +%m) + 1)) locale_next_month=$(date -d$current_year/$next_month/1 +%B) for day_of_month in $(seq 1 31) do if day_of_year=$(date -d$current_year/$next_month/$day_of_month +%j 2> /dev/null) then mkdir -p /home/applications/app_name/$current_year/$locale_next_month/$day_of_year fi done 1 solved Create directory structure in unix [closed]

[Solved] Passing Parameters from PHP to Shell

If you want to receive and pass it on to the shell, then use this: <?php if( !empty( $_POST ) ) { $min = $_POST[‘MIN’]; $max = $_POST[‘MAX’]; $norm = $_POST[‘NORM’]; echo shell_exec(“action.sh $min $max $norm”); } ?> <form method=”POST”> Min: <input type=”number” name=”MIN” value=”<?php echo $min;?>”> <br><br> Norm: <input type=”number” name=”NORM” value=”<?php echo $norm;?>”> … Read more