7 deleted 390 characters in body
source | link
IFS=$'\037'IFS=$'\n'
array=( $(awk 'BEGIN { ORS="\037" } '{ print "\"" $0 "\"" }' input_file) )

037 is the octal ASCII code for the unit separator (US) character.

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a USnewline character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies any sequence of characters not including the IFS character but terminated by an IFS character to be a distinct "word". Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the substituted tokens in between (which are your lines placed side-by-side each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
  • Instead of using the US character as the delimiter, it is possible to use any other character that you know does not and/or will not appear in your input file. The US character is probably a safe bet, and my solution does assume that the US character does not appear in your file.
IFS=$'\037'
array=( $(awk 'BEGIN { ORS="\037" } { print "\"" $0 "\"" }' input_file) )

037 is the octal ASCII code for the unit separator (US) character.

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a US character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies any sequence of characters not including the IFS character but terminated by an IFS character to be a distinct "word". Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the substituted tokens in between (which are your lines each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
  • Instead of using the US character as the delimiter, it is possible to use any other character that you know does not and/or will not appear in your input file. The US character is probably a safe bet, and my solution does assume that the US character does not appear in your file.
IFS=$'\n'
array=( $(awk '{print "\"" $0 "\""}' input_file) )

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a newline character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies any sequence of characters not including the IFS character but terminated by an IFS character to be a distinct "word". Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the substituted tokens in between (which are your lines placed side-by-side each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
6 deleted 14 characters in body
source | link
IFS=$'\037'
array=( $(awk 'BEGIN { ORS="\037" } { print "\"" $0 "\"" }' input_file) )

037 is the octal ASCII code for the unit separator (US) character.

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a US character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies any sequence of characters not including the IFS character but terminated by an IFS character to be a distinct "word". A "word" also does not include any IFS character. Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the substituted tokens in between (which are your lines each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
  • Instead of using the US character as the delimiter, it is possible to use any other character that you know does not and/or will not appear in your input file. The US character is probably a safe bet, and my solution does assume that the US character does not appear in your file.
IFS=$'\037'
array=( $(awk 'BEGIN { ORS="\037" } { print "\"" $0 "\"" }' input_file) )

037 is the octal ASCII code for the unit separator (US) character.

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a US character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies any sequence of characters terminated by an IFS character to be a distinct "word". A "word" also does not include any IFS character. Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the tokens in between (which are your lines each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
  • Instead of using the US character as the delimiter, it is possible to use any other character that you know does not and/or will not appear in your input file. The US character is probably a safe bet, and my solution does assume that the US character does not appear in your file.
IFS=$'\037'
array=( $(awk 'BEGIN { ORS="\037" } { print "\"" $0 "\"" }' input_file) )

037 is the octal ASCII code for the unit separator (US) character.

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a US character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies any sequence of characters not including the IFS character but terminated by an IFS character to be a distinct "word". Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the substituted tokens in between (which are your lines each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
  • Instead of using the US character as the delimiter, it is possible to use any other character that you know does not and/or will not appear in your input file. The US character is probably a safe bet, and my solution does assume that the US character does not appear in your file.
5 added 54 characters in body
source | link
IFS=$'\037'
array=( $(awk 'BEGIN { ORS="\037" } { print "\"" $0 "\"" }' input_file) )

037 is the octal ASCII code for the unit separator (US) character.

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a US character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies aany sequence of characters terminated by an IFS character to be a distinct "word". A "word" also does not include any IFS character. Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the tokens in between (which are your lines each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
  • Instead of using the US character as the delimiter, it is possible to use any other character that you know does not and/or will not appear in your input file. The US character is probably a safe bet, and my solution does assume that the US character does not appear in your file.
IFS=$'\037'
array=( $(awk 'BEGIN { ORS="\037" } { print "\"" $0 "\"" }' input_file) )

037 is the octal ASCII code for the unit separator (US) character.

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a US character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies a sequence of characters terminated by an IFS character to be a distinct "word". Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the tokens in between (which are your lines each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
  • Instead of using the US character as the delimiter, it is possible to use any other character that you know does not and/or will not appear in your input file. The US character is probably a safe bet.
IFS=$'\037'
array=( $(awk 'BEGIN { ORS="\037" } { print "\"" $0 "\"" }' input_file) )

037 is the octal ASCII code for the unit separator (US) character.

For every line in the input_file, from top to bottom, the awk command in the command substitution does the following:

  1. Surround the line with a pair of double quotes.
  2. End the double-quoted line with a US character.
  3. Print the resulting line to the standard output.

However, instead of printing to the standard output, the result of the awk command is used to replace the entire command substitution. The replacement is the result of the command substitution.

Next, word-splitting is then applied to the result of the command substitution. The word-splitting identifies any sequence of characters terminated by an IFS character to be a distinct "word". A "word" also does not include any IFS character. Therefore, in this particular case, a "word" is any line (from the input_file) that has been enclosed with a pair of double quotes by the awk command.

Since the command substitution is enclosed by the outermost pair of parentheses (), the result of awk is placed in between those parentheses, and the shell treats the entire parentheses including all the tokens in between (which are your lines each enclosed by a pair of double quotes) as an array.

NOTE:

  • After the array assignment, you might want to reset the shell variable IFS back to its original value of a space, a tab, and a newline.
  • Instead of using the US character as the delimiter, it is possible to use any other character that you know does not and/or will not appear in your input file. The US character is probably a safe bet, and my solution does assume that the US character does not appear in your file.
4 added 59 characters in body
source | link
3 added 209 characters in body
source | link
2 added 209 characters in body
source | link
1
source | link