0

Currently I have:

a.html
b.html
c.html
d.html
e.html

I want this:

a.html 1.css
b.html 2.css
c.html 3.css
d.html 4.css
e.html 5.css

I know how to add a text at the end of each line like

awk '{print $0"append_to_end"}' file

But I need to add an iterative text (1.css, 2.css, etc) at the end of every line. How to do this using C or Shell Script or Python? I am using Ubuntu.

HackCode
  • 1,837
  • 6
  • 35
  • 66

1 Answers1

1

You can do it with awk just fine. Basically exactly like that.

awk '{print $0 ++i".css"}' file
Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
  • Thanks but I already have the "file". How do I append the result of this to every line in the file? – HackCode Feb 16 '15 at 16:50