Skip to content

Instantly share code, notes, and snippets.

@gdelpierre
Last active April 5, 2017 15:11
Show Gist options
  • Save gdelpierre/fe79913075e35e4b1688d3d6fd43a317 to your computer and use it in GitHub Desktop.
Save gdelpierre/fe79913075e35e4b1688d3d6fd43a317 to your computer and use it in GitHub Desktop.
80 colonnes on a dit
#include <stdio.h>
int maxline=80;
int main(int argc, char* argv[])
{
char line[2048];
if( (argc>1) && (atoi(argv[1])>0) ) maxline=atoi(argv[1]);
while(fgets(line,sizeof(line),stdin)) {
line[maxline]='\0'; printf("%s\n",line);
}
}
@gdelpierre
Copy link
Author

@outini il dit sed 's/^\(.\{80\}\).*/\1/'

@gdelpierre
Copy link
Author

gdelpierre commented Apr 5, 2017

awk '{ print substr($0, 0, 81) }'
sed 's/^\(................................................................................\).*/\1/'
sed "s/^\($(perl -e "print '.' x 80")\).*/\1/"
fold -w 80
cut -c 1-80```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment