Let's say we got a content of the following command in bash, which consists of several rows, and just one column:

tacmd listsystems | grep -i $i | awk '{print $1}'

This content is a list of offline machines you got on a server and you want to write it into the file e.g. offline.lst, in order to remove offline entries on a server from that file.

How do I write this specific content into offline.lst?

tacmd listsystems | grep -i $i | awk '{print $1}' >> offline.lst

The >> operator tells bash to append output to a file.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.