commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Add permanent line numbers to a file without creating a temp file.
The rm command deletes file10 while the nl command works on the open file descriptor of file10 which it outputs into a new file again named file10.
The new file10 will now be numbered in the same directory with the same file name and content as before, but it will in fact be a new file, using (ls -i) to show its inode number will prove this.
There is 1 alternative - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.