Sample Header Ad - 728x90

Appending lines with incrementing numbers to a file

1 vote
2 answers
2219 views
I have a text file, and I would like to add lines to the file arranged as follows; #define ICFGx 0x2y where x is a decimal number that begins at 0 and ends at 255, incrementing by 1 with each line and y is a hexadecimal number that begins at 000 and ends at 3FC, incrementing by 0x004 with each line. #define ICFG0 0x2000 #define ICFG1 0x2004 #define ICFG2 0x2008 #define ICFG3 0x200C I would also like add them from a certain line onward, say line 500. Is there any way to go about this task from the command line? I'm fairly new to using the linux terminal and I haven't done much bash scripting yet.
Asked by Ca01an (11 rep)
Sep 20, 2018, 03:01 PM
Last activity: Jun 23, 2023, 09:15 AM