1

so this is my out put when i cat multiple config files and grep name of file and modified date.

/path-to-file/name of file
modified date
/path-to-file/name of file
modified date
/path-to-file/name of file
modified date

I want the output to be like this and if possible add comma after the word 'file'.

/path-to-file/name of file, modified date
/path-to-file/name of file, modified date
/path-to-file/name of file, modified date
/path-to-file/name of file, modified date
fer
  • 7
  • 2

2 Answers2

1

pipe your output to awk '{printf "%s%s",$0,NR%2?", ":"\n"}'

Kent
  • 181,427
  • 30
  • 222
  • 283
0

Pipe your output into paste -d, - - which will join each pair of lines from the input.

glenn jackman
  • 223,850
  • 36
  • 205
  • 328