unix map function unix map function unix unix

unix map function


Since you say "transforming" I'm assuming you mean that you want to capture the output of the loop in a variable. You can even replace the contents of your $dates variable.

dates=$(for i in "$dates"; do date -d "@$i" '+%a_%D'; done)


Create a function:

foo () {        for i in $@        do                date -d "1970-01-01 $i sec UTC" '+%a_%D'        done}

Then you can e.g. send the output to standard error:

echo `foo $dates` >&2


Your question is a bit vague, but the following may work:

for ...do ...done | ...