0

I have an array in arr which contains list of strings - (string1 string2 string3 ...)

How do I append these elements to a text file one element per line.

The elements could be of any data type. But I need to write those elements one per each line like:

string1
string2
string3
.
.
.
Underoos
  • 4,708
  • 8
  • 42
  • 85

1 Answers1

1

Like this:

printf '%s\n' "${array[@]}" > new_file
Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223