Good afternoon, there is a file with the following contents:
name1 PoweredOff 192.168.250.31 Debian GNU/Linux 6 (64-bit) Other 2.6.x Linux (64-bit) name2 PoweredOn 192.168.250.99 Debian GNU/Linux 6 (64-bit) Other 3.x Linux (64-bit) We need to bring it to mind:
|name1|PoweredOff|192.168.250.31|Debian GNU/Linux 6 (64-bit)|Other 2.6.x Linux 64-bit)| |name2|PoweredOn|192.168.250.99|Debian GNU/Linux 6 (64-bit)|Other 3.x Linux (64-bit)| I tried to do this:
IFS=$'\n'; for i in $(cat file); do if [[ -n $i ]]; then tr -s '\n' ' '; fi; done but it does not work
bashfor this! Besides the fact thatfor i in $(cat file)is wrong. - 0andriy