I would like to know how to count the characters in every line in a text, then subtracting this number from a threshold represents the maximum number of characters allowed per line, after then I would like to fill the gaps between the maximum number of characters and the count of characters with dots. For example:  Unix was  originally meant  to be a  co nvenient p latform for progra mmers developing software to  be run on it and on other  systems, rather than for non- programmers. [7][8] The system grew larger  as the operating system star ted spreading in a cademic circ les, as users add ed their own tools to th e system and shared them wi th colleagues.   The maximum number of characters over all the lines is /31/ in line#11. I would like the count of characters in every line to be /31/ by filling the empty spaces with dots, like this:  Unix was , ..................... originally meant , ............. to be a , ...................... co, ............................ nvenient p, .................... latform for progra, ............ mmers developing software to, .. be run on it and on other , .... systems, rather than for non-,.. programmers., .................. [7][8] The system grew larger,.. as the operating system star, .. ted spreading in a, ............ cademic circ, .................. les, as users add, ............. ed their own tools to th, ...... e system and shared them wi, ... th colleagues., ................   How can I do that in bash?
10087
I'd like to output hello world over 20 characters.  printf "%-20s :\n\n" 'hello world!!'  # Actual output hello world!!        :  # Wanted output hello world!!========:   However, I don't want to complete with spaces but with "=" instead. How do I do that?
15664
I have a text file named links.txt which looks like this  link1 link2 link3   I want to loop through this file line by line and perform an operation on every line. I know I can do this using while loop but since I am learning, I thought to use a for loop. I actually used command substitution like this   a=$(cat links.txt)   Then used the loop like this  for i in $a; do ###something###;done   Also I can do something like this  for i in $(cat links.txt); do ###something###; done   Now my question is when I substituted the cat command output in a variable a, the new line characters between link1 link2 and link3 are removed and is replaced by spaces  echo $a   outputs  link1 link2 link3  and then I used the for loop. Is it always that a new line is replaced by space when we do a command substitution??  Regards
21123
Would like to have each line in a file repeated a fixed number of times.  e.g. have each line repeated four times:  a b c   becomes:  a a a a b b b b c c c c   I've done some searching, and there are a lot of questions and answers along the lines of doing the reverse, e.g. merging duplicate lines into single lines, and maybe a few about doubling lines by printing them again.  It would be easy to do this in C, but I wish I knew more about the native commands so I wouldn't have to resort to these kinds of one-off throw-aways all the time.
84826
So I have a lot of data WITHOUT NEW LINES on the clipboard (it's a large SVG file on one line). I went  $ cat &gt;file.svg   then tried to paste (in Gnome Terminal), but only the first 4kB characters were accepted.  I assume this is a readline feature/limitation.  Is there a way to read from STDIN that would avoid this problem?  EDIT  Test case: Create a demo file. This one will have ~4k "=" symbols followed by "foo bar".  { printf '=%.0s' {1..4095} ; echo "foo bar" ; } &gt; test.in   Copy that into your clipboard  xclip test.in   (if you want to middle-click to insert) or  xclip -selection clipboard test.in   (if you want to use Ctrl-Shift-Insert to past it in)  Then cat &gt;test.out, paste (whichever way). Press Ctrl-D to end the stream. cat test.out - do you see "foo bar"?  On my set-up (Ubuntu 12.04, Gnome Terminal, zsh) when I paste I only see the = and I don't see foo bar. Same when I inspect test.out.
11935
Windows 10 is killing me. I want to write some file names with more than 80 characters. I have a folder path like that: C:\Users\MyUser\Documents\Formations\Maitriser les outils vectoriels d Illustrator et de Photoshop\Illustrator CC - L art des courbes vectorielles\02 - Demarrer cette formation sur Illustrator CC. When I create a file into that folder and start typing the file name Windows only let me type only 50 characters. For example: Nouveau document texte jhkds fjkdshfkj sfhjsdh.txt. When I get into C:\Users\MyUser\Documents\Formations\Maitriser les outils vectoriels d Illustrator et de Photoshop\Illustrator CC - L art des courbes vectorielles it let me write at maximum 99 characters like Nouveau document texte khfjddjg djfhjdshf jdshf sdfsjdfjsd fds fsd fjsdfjdsjfhsdjfh djsfhjsdhfj.txt. When I get into C:\Users\MyUser\Documents\Formations\Maitriser les outils vectoriels d Illustrator et de Photoshop it allows me to write a file name with maximum 147 characters like Nouveau document texte djkshfkjs djfk hfjdshjf jshfjhsd fjshfjs dhfjhs djfhsjdhf jsdhfjhsdj fhds fhsdj fjdshfj hsdjhf sdhfjh sdjhf shdjf sjdhf .txt. each time I get closer to c:\ it increases the filename maximum length.  I even create a Python script to try to create a filename longer than the maximum allowed by Windows, Python throws an exception like File or directory not found (something like that).  I have LongPathsEnabled set to 1 in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.  My Hard drive is GPT and NTFS, it has 2 NTFS partitions.  What is wrong with Windows? How to fix it?
88892
I would like the whitespace between two items within a table to be filled with dots.  Please consider the following picture to get the idea.    So far I tried to achieve this output with the following sequence.  %!TEX TS-program = xelatex %!TEX encoding = UTF-8 Unicode \documentclass[10pt]{article} \usepackage{booktabs}  \begin{document}  \begin{table}[!htbp]  \begin{tabular}{lrrr}         \toprule     Anzahl &amp; Behandlungstyp &amp; Einzelpreis &amp; Gesamtpreis\\         \midrule     10\dotfill&amp; Manuelle Therapie\dotfill &amp; €32,63\dotfill &amp; €326,30\\     10\dotfill &amp;Krankengymastik\dotfill &amp;€26,93\dotfill &amp;€269,30\\         \bottomrule     \end{tabular}  \end{table}  \end{document}   This, however, yields an unsatisfactory output, where undotted gaps are left over.   How to achieve a continuous dotted line without white spaces like in the first picture?
110344
I am working on mac with sed, perl, awk, bash..  I have a large-ish (10GB) text file which has 13 fields (columns) of TAB delimited data. Unfortunately some of these lines have extraneous TABs , so I want to delete the entire line where we have extra TABs , and thus unequal fields.  (I don't mind discarding the lines in their entirety)   What I currently have writes the number of fields into another file.    awk -F'\t' '{print NF}' infile  &gt; fieldCount  head fieldCount 13 13 10 13 13 13 14 13 13 13   I would like to construct a short script that removes any line with more (or less) than 13 proper fields (from the original file).    speed is helpful as I have to do this on multiple files doing it in one sweep would be cool I currently am porting the fieldCount file into Python, trying to load with line by line.   EDIT:  vaild (13 columns)  a       b       c       d       e       f       g       h       i       j       k       l       m   invalid (14 columns)  a       b       c       d       e       f       g       h       i       j       k       l       m       n
71270
How would you perform a grep for text that appears on two lines?   For example:  pbsnodes is a command I use that returns the utilization of a linux cluster  root$ pbsnodes node1     state = free     procs = 2     bar = foobar  node2     state = free     procs = 4     bar = foobar  node3     state = busy     procs = 8     bar = foobar   I want to determine the number of procs that match nodes that are in state 'free'. So far I have been able to determine the "number of procs" and "the nodes in free state", but I want to combine them into one command that shows all free procs.   In the above example, the correct answer would be 6 (2+4).   What I have  root$ NUMBEROFNODES=`pbsnodes|grep 'state = free'|wc -l` root$ echo $NUMBEROFNODES 2  root$ NUMBEROFPROCS=`pbsnodes |grep "procs = "|awk  '{ print $3 }' | awk '{ sum+=$1 } END { print sum }'` root$ echo $NUMBEROFPROCS 14   How can I search for every line that reads 'procs = x', but only if the line above it reads 'state = free?
116952
I am suggesting dramatically lowering the custom text characters allowed in any bounty from 3000 to the length of a comment (600). The reasons for this is as follows:  There are no  in bounty texts  There is only  available  That many characters in a single paragraph is completely TL;DR  Allowing 3000 characters is a strong suggestion you can use more complicated formatting which makes even short (with respect to the character limit) bounty texts    Probably 100x (or more) easier to implement this than adding full markdown to bounty text   Note that this entire post is barely 1/3 the allowed character limit.
31819
I currently making a songbook and thus I want to display chords above lyrics. I have found several packages but I want to improve my TeXing skills so I wrote everything from scratch.  Until now, everything works fine apart from one thing: some chords are too long and overlaps with the next one.  I have some way to do it, by explaining each time what text correspond to each chord (see the second part of the minimal example) but it would mean rewriting all song I already have. So I wanted to know if there was a way to automatically add space when needed, without having to specify which text correspond to which chord!  Here is a minimal example (the whole code is much longer but I don't think it's needed here):  \documentclass{article}  \def\ch#1{%   \leavevmode\hbox to 0pt{\vbox{\hbox{\strut\tt#1}\kern.25cm}\hss}% }  \begin{document}   \parskip.15cm    \ch{A}Lorem ipsum \ch{B}dolor sit amet, \ch{C}consectetuer \ch{D}adipiscing elit.    \ch{A}Ut purus elit, vesti\ch{B}bulum \ch{C}ut, placerat ac, adipiscing vitae, \ch{D}felis.    \ch{A}Curabi\ch{B7sus4}tur \ch{C}dictum \ch{D7sus4}gravi\ch{E}da mauris.    \bigskip   \textit{I would want to have something that look like this:}\par   \def\foo#1#2{%     \leavevmode\vbox{\hbox{\strut\tt#1 }\hbox{#2}}%   }   \foo{A}{Curabi}\foo{B7sus4}{tur} \foo{C}{dictum}  \foo{D7sus4}{gravi}\foo{E}{da mauris}.  \end{document}   which gives   Note: I know that this might not be possible on justified multi-line paragraph, but we only have flushed/centered paragraph here (or even single lines), so the space between words should be fixed (I guess?).
45384
If I use cat -n text.txt to automatically number the lines, how do I then use the command to show only certain numbered lines.
11324
Is there a way like wrap the line after at most 60 letters but it should not break inside some commands like listings does?  Example:      \documentclass[a5paper]{article}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{listings}     \usepackage{xcolor}      \lstset{%       language=[LaTeX]TeX,       backgroundcolor=\color{gray!25},       basicstyle=\ttfamily,       breaklines=true,       columns=fullflexible     }      \begin{document}     \begin{lstlisting}     The roadrunner is the fastest running bird \remark{Check this again with a zoologist!}.     \end{lstlisting}     \end{document}   Output:      The roadrunner is the fastest running bird         remark{Check this again with a zoologist!}.   That should not happen! In my eyes this problem is not discussed in .
13333
I need to display whole file before tracking it for a new changes, not only the last 10 lines (yep, I know it's not tail conceptually). In other words, something like cat -f would do, if it would ever existed. Tail's man doesn't give me any ideas. The only option I see right now is to somehow combine cat all but last 10 lines and tail -f output.  Any hints, please?
84507
I am writing a small KOMA-Script scrartcl document with multiple sections. In the table of contents, LaTeX fills the current line with dots between the end of the section name and the page number. Is there any way to customize this behavior? I would like to reduce the space between the single dots (i.e. use more dots in the same space).
112657
I know I can solve this problem several ways, but I'm wondering if there is a way to do it using only bash built-ins, and if not, what is the most efficient way to do it.  I have a file with contents like  AAA B C DDD FOO BAR   by which I only mean it has several lines and each line may or may not have spaces.  I want to run a command like  cmd AAA "B C DDD" "FOO BAR"   If I use cmd $(&lt; file) I get  cmd AAA B C DDD FOO BAR   and if I use cmd "$(&lt; file)" I get  cmd "AAA B C DDD FOO BAR"   How do I get each line treated a exactly one parameter?
81882
What does the command :  ls | wc -l   do? I know     wc &lt;filename&gt;   gives lines, words, and characters, and   wc -l &lt;filename&gt;    print the line count. But how it is being used with ls` is not clear. What does it do?
41041
I often format path names with \texttt which can be very long. Usually Tex will not break this text. The line will just create a hbox overflow. It looks like this:  ................ ...C:\documents and settings ................ ................ ................ ................ ................ ................ ................   How do I get Tex to create a line break?