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
  • 189,393
  • 32
  • 233
  • 301
0

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

glenn jackman
  • 238,783
  • 38
  • 220
  • 352