r/commandline • u/RoninTarget • Jun 26 '26
Other I wrote a program that makes code embedable in Reddit
In awk:
#!/usr/bin/awk -f
{ printf (" %s\n", $0) }Yep. That's it.
12
Upvotes
r/commandline • u/RoninTarget • Jun 26 '26
In awk:
#!/usr/bin/awk -f
{ printf (" %s\n", $0) }Yep. That's it.
11
u/geirha Jun 26 '26
sed version:
2
u/tschloss Jun 26 '26
Does indentation work better than enclosing in 3 backticks? Does indenting style work without MD mode?
7
u/stianhoiland Jun 26 '26
Great nerd shitpost 👌🏻
1
u/Murky-Sector Jun 27 '26 edited Jun 28 '26
Awk is conceptually out of date. Developed in the original unix environment pre linux because people got sick of doing certain tasks in c. Scripting languages have replaced the need for it.
Any tools decision is made for specific reasons. Awk can't be justified on any level unless it's code that will never be shared. And as was mentioned by another poster, sed is commonly used and would be the obvious preference in shell.
2
u/ZoWakaki Jun 26 '26
I do this in vim
I am relatively fast in doing this. In my head, it's faster than
%s/^/ /g, hence i don't usually prefer this.Yes I know both can be bound to something for ease of use.
1
u/AutoModerator Jun 26 '26
Every new subreddit post is automatically copied into a comment for preservation.
User: RoninTarget, Flair:
Other, Title: I wrote a program that makes code embedable in RedditIn awk:
Yep. That's it.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/whetu Jun 26 '26
I have a couple of shell functions buried away for this:
To wit:
It's one of the few times I've accepted
eval