Quote:
Originally Posted by colucix
Sorry, but I don't follow you anymore. What are you trying to achieve? Where this variable comes from? Is it created in a shell script or something? Can you provide a real example?
Does this match what you're trying to do?
Code:
#!/bin/bash
var1=Field1,Field2,Field3
var2=$(echo $var1 | awk -F, '{for (i=1; i<=NF-1; i++) printf "%s, ","FRNT_" $i "_END"; printf "%s","FRNT_" $NF "_END"}')
echo $var2
|
You are right, this is what I am looking for
But without using other variable (just for my interest). The result should be in the same variable. Just like you have done with the file