Skip to content

Tag: bash

Separate Text file to columns by ;

Please I have a text file separated by spaces. I would like to output it to columns separated by ; example Input I use this code My output Output desired. Appreciate your help. Answer $1=$1 is a trick to rebuild $0 with the new separator OFS=’;’.

parsing complex string using shell script

I’m trying the whole day to find a good way for parsing some strings with a shell script. the strings are used as calling parameter for some applications. they looks like: I’m only allowed to use shell-script. I tried to use some sed and cut commands but nothing works fine. My tries are like: that…

Do here-strings undergo word-splitting?

Quoting Bash Reference Manual and man bash (version 4.3): [n]<<< word The word undergoes brace expansion, tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal. Pathname expansion and word splitting are not performed. The word should not unde…

Bug while checking for symbols inside of a string?

I’m creating a small calculator script and I’ve got stumbled on a strange bug. Everything seems to work but not when I input anything starting with (. When I do that if gives false and the code inside of else executes. I’ve tried a lot of ways rewriting how should “$input” =~ [-,…

Recursively check the difference between files in shell

I am trying to recursively check the difference between files in 2 separate directories in shell. NOTE :- both directories are identical only the root name is different In the diagram shown above I want to “diff ROOT_A/A.md5 ROOT_B/A.md5” recursively in my script file for all files in the root dir…