While getting sample code from internet, it may comes with line number. To simply remove those lines from the code file use the below ways.
Using sed command with RegEx pattern in Linux, that can be achieved.
To remove it from console:
$ sed -i "s/^ *[0-9.]* *//g" code.txtTo remove it from vim interface:
:%s/^ *[0-9.]* *//gAnd the same RegEx pattern can be used in anywhere to remove the line numbers from the source code file.
No comments:
Post a Comment