Timeline for Split line into key-value pairs based on first string
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 5, 2016 at 21:00 | comment | added | don_crissti | Avoid using while read when processing text. | |
| Jan 8, 2016 at 9:21 | comment | added | jai_s | set is a shell builtin command. args to set are available to the shell as positional parameters - more details under the "SHELL BUILTIN COMMANDS" part of the bash manual. The script loops over lines in the input file and reads each line (eg., A B C..) and does a "set" to make these available as $1 , $2 etc. to the shell. It then loops over all the parameters ($*) and prints the first one each time followed by the the next (this is $1). shift is used to shift the parameters to the left so that $2 becomes $1, then $3 and so on. | |
| Jan 8, 2016 at 9:05 | comment | added | Michael Hoffmann | What does set $x do? This code may work, but explaining why will help more than just dumping it. | |
| Jan 8, 2016 at 5:22 | review | Low quality posts | |||
| Jan 8, 2016 at 5:58 | |||||
| Jan 8, 2016 at 5:04 | history | answered | jai_s | CC BY-SA 3.0 |