Skip to main content
deleted 42 characters in body
Source Link
Janis
  • 14.4k
  • 4
  • 28
  • 42

With GNU awk (version 4.x) try this:

awk  '
  ENDFILE'ENDFILE { printf "%d %s %s %s\n", ++c, $8, $9, $10}'
' *mcp > "${Pout}${output}"

echo "Finished Looping through each file."

With other awks and shells like bash try:

for f in *mcp
do
  (( ++c ))
  awk -v c="$c" '
   c="$((++c))" END'END { printf "%d %s %s %s\n", c, $8, $9, $10}'
  ' "$f"
done > "${Pout}${output}" 

echo "Finished Looping through each file."

With GNU awk (version 4.x) try this:

awk  '
  ENDFILE { printf "%d %s %s %s\n", ++c, $8, $9, $10}'
' *mcp > "${Pout}${output}"

echo "Finished Looping through each file."

With other awks and shells like bash try:

for f in *mcp
do
  (( ++c ))
  awk -v c="$c" '
    END { printf "%d %s %s %s\n", c, $8, $9, $10}'
  ' "$f"
done > "${Pout}${output}"
echo "Finished Looping through each file."

With GNU awk (version 4.x) try this:

awk 'ENDFILE { printf "%d %s %s %s\n", ++c, $8, $9, $10}' *mcp > "${Pout}${output}"

echo "Finished Looping through each file."

With other awks and shells like bash try:

for f in *mcp
do
    awk -v c="$((++c))" 'END { printf "%d %s %s %s\n", c, $8, $9, $10}' "$f"
done > "${Pout}${output}" 

echo "Finished Looping through each file."
Source Link
Janis
  • 14.4k
  • 4
  • 28
  • 42

With GNU awk (version 4.x) try this:

awk  '
  ENDFILE { printf "%d %s %s %s\n", ++c, $8, $9, $10}'
' *mcp > "${Pout}${output}"

echo "Finished Looping through each file."

With other awks and shells like bash try:

for f in *mcp
do
  (( ++c ))
  awk -v c="$c" '
    END { printf "%d %s %s %s\n", c, $8, $9, $10}'
  ' "$f"
done > "${Pout}${output}"
echo "Finished Looping through each file."