0

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?

muru
  • 197,895
  • 55
  • 485
  • 740

1 Answers1

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

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

heemayl
  • 91,753