I'm looking to print a dash "-" until the end of the user's screen.  Basically my program would print a line of text and then a line of dashes beneath it and then another line of text. This would be done so that the user can easily distinguish between the first and second line.   Something like this:  First line of text -------------------------------------------------------------------------------------- Second line of text   Is there a way for me to do this using the standard python 2.6 libraries. I cannot use any additional libraries such as texttable or a newer version of Python.
3802
Is there a way in python to programmatically determine the width of the console? I mean the number of characters that fits in one line without wrapping, not the pixel width of the window.  Edit  Looking for a solution that works on Linux
84523
If I am having a line as:  Thhiisss iisss mmyyy nameeee   I want to print this as:  This is my name   What is the unix command for this?
47297
I have a program that receives an argument and prints it every second:    ~# ./myapp 234 234 234 234 234 ...     I want to be able to run it in the background and right after a shell but it must be in one line (I don't want to explain why I need it because I don't want to make the discussion too complicated right now).    This is what I tried and the error I received:    ~# bash -c "./myapp 234 &amp;; sh"  bash: -c: line 0: syntax error near unexpected token `;' bash: -c: line 0: `./myapp 234 &amp;; sh'   I also tried with &amp;&amp; as separator:    ~# bash -c "./myapp 234 &amp; &amp;&amp; sh"  bash: -c: line 0: syntax error near unexpected token `&amp;&amp;' bash: -c: line 0: `./myapp 234 &amp; &amp;&amp; sh'   Any idea how I can solve it?    EDIT: Thanks to @roaima. I also found a link that talks about it:
96079
I am using the following code to read specific lines in an ASCII file "text.dat"  sed -n '/Columnaxis/p' text.dat   The output is   Columnaxis: 100   In order to output only the second part previous line, I added the following to the previous command line:   sed -n '/Columnaxis/p' text.dat | awk '{ print $2 }'   The output of the last command is "100"  How can I update the last code to output negative numbers, regardless of the number's original sign? ( i.e if the input is "+100" I want the code to output "-100" also if the input is "-100", I want the code to output "-100"  PS. The content of text.dat is something like the following :  Columnaxis: 100 Columnaxis_1: 100 Columnaxis_2: -100 Columnaxis_3: 50 Columnaxis_4: -2.3 Columnaxis_5: 1.2 Columnaxis_6: -5 Columnaxis_7: -2 Columnaxis_8: -4 Columnaxis_9: -2   I want the code to output the following:  Columnaxis: -100   Let's say that the input has "Columnaxis: +100", then I want it to be  Columnaxis: -100
37919
I want to print the odd-numbered and even-numbered lines from files.  I found this shell script which makes use of echo.  #!/bin/bash # Write a shell script that, given a file name as the argument will write # the even numbered line to a file with name evenfile and odd numbered lines # in a text file called oddfile. # ------------------------------------------------------------------------- # Copyright (c) 2001 nixCraft project &lt;http://cyberciti.biz/fb/&gt; # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # -------------------------------------------------------------------------  file=$1 counter=0  eout="evenfile.$$" # even file name oout="oddfile.$$" # odd file name  if [ $# -eq 0 ] then     echo "$(basename $0) file"     exit 1 fi  if [ ! -f $file ] then     echo "$file not a file"     exit 2 fi  while read line do     # find out odd or even line number     isEvenNo=$( expr $counter % 2 )      if [ $isEvenNo -ne 0 ]     then         # even match         echo $line &gt;&gt; $eout     else         # odd match         echo $line &gt;&gt; $oout     fi     # increase counter by 1     (( counter ++ )) done &lt; $file echo "Even file - $eout" echo "Odd file - $oout"   But isn't there a way to do it in one line?  Yes, use awk, I read.  Even-numbered lines:  awk 'NR % 2' filename   odd-numbered lines:  awk 'NR % 2 == 1' filename   But it doesn't work for me. Both produce the same output, according to diff. When compared to the original file, they are both indeed half as long, and they both contain the odd-numbered lines. Am I doing something wrong?
21860
I'm trying to debug a Python script by placing a print("foo=" + foo) statement in my code.  But where does the output appear?     It doesn't appear on the Python Console, and it doesn't appear on the area that appears when you drag the lower edge of the infobar downwards (what is the name for this area? My script errors show up in red here.)
25091
I've found I can make punctuation happen by saying "comma", or "period", but I can't find the word for new line.  I tried "paragraph", and "line break", but it just prints those words.
94793
I have a text file like so  foo bar baz 1   a   alpha 2   b   beta 3   c   gamma   I can use awk to print certain columns, like 1 and 3, with {print $1, $3}, but I want to specify the columns to print by specifying the header of the column instead, something like {print $foo, $baz}. This is useful so I don't have to open the file and count the columns manually to see which column is which, and I don't have to update the script if the column number or order changes. Can I do this with awk (or another shell tool)?
93115
This may or may not be a real TeX/LaTeX question but rather a general question on punctuation:  How are the different dashes - "-", -- "–" and --- "—" supposed to be used?
16793
I have a multi line log entry format that I need to process.   The log looks something like this:   --START-- Device=B Data=asdfasdf Lorem=Ipsum --END-- --START-- Device=A Data=asdfasdf Lorem=Ipsum --END-- --START-- Device=B Data=asdfasdf --END-- --START-- Device=A Data=asdfasdf --END-- --START-- Device=B Data=asdfasdf --END-- --START-- Device=C Data=asdfasdf Lorem=Ipsum --END--   I want to print everything between --START-- and --END-- if a particular pattern is matched.   e.g:   Print all entries where Device=A  --START-- Device=A Data=asdfasdf Lorem=Ipsum --END-- --START-- Device=A Data=asdfasdf --END--   All I've been able to do so far is write:   sed -e -n '/--START--/,/--END--/p' &lt; input   Which effectively prints the input but I think I need to add {} to filter with N and then print if that condition matches.   I also think I'm completely lost.  Any idea on how to print multiple lines if a single line matches a condition?
69254
Similar to , I am trying to output a similar matrix with dotted line instead of dashed line.       Is there anyway to do this? I also try to use these three packages:  \usepackage{tabularx} \usepackage{longtable} \usepackage{arydshln}  I also like to learn how to implement this in \documentclass{revtex4}, in addition to using in \documentclass{article}. As far as we know that arydshln may not be compatible with revtex4 or revtex4-1 as far as I tried.   . And I add arydshln after the tabularx; but it cannot compile successfully, but only output errors. Could someone offer any hints or some resolutions?  The answer needs not to be complete. Thank you for your help!!!
100626
For example {a..c}{1..3} expands to a1 a2 a3 b1 b2 b3 c1 c2 c3.   If I wanted to print a1 b1 c1 a2 b2 c2 a3 b3 c3, is there an analogous way to do that? What's the simplest way?
65022
I want to implement a function name color highlighting and I use the listings package. My 'regex' for this is def %s( where def (including space) is the first delimiter %s is the function name and ( is the second delimtier. Now my aim is to color only %s in purple. So basically I want to only touch the part between the delimiters and the delimiters should stay untouched.  Here is what I tried so far:  \documentclass{article} \usepackage{xcolor,listings} \usepackage[ngerman]{babel} \usepackage{fontspec} \setmonofont{Courier New}  \begin{document}  \lstset{language=Python,     escapebegin=\color{orange},     keywordstyle=\color{blue}\bfseries,     commentstyle=\color{orange!80!red},     stringstyle=\ttfamily\color{gray},     %moredelim = [is][\color{blue}\bfseries def \mdseries\color{purple}]{def\ }{(},     moredelim = [s][\color{purple}]{def\ }{(},     showstringspaces=false}‎ \lstset{literate=%    *{0}{{{\color{red}0}}}1     {1}{{{\color{red}1}}}1     {2}{{{\color{red}2}}}1     {3}{{{\color{red}3}}}1     {4}{{{\color{red}4}}}1     {5}{{{\color{red}5}}}1     {6}{{{\color{red}6}}}1     {7}{{{\color{red}7}}}1     {8}{{{\color{red}8}}}1     {9}{{{\color{red}9}}}1 }  ‎‎\begin{lstlisting}[basicstyle=\ttfamily,mathescape] def fancy_function_name(page_url = 'tex.stackexchange.com'):     return page_url.split('.')[0] \end{lstlisting}  \end{document}   This code will generate:   You can see that it matches the right place but is too greedy and colors the delimiters too. So I thought about the uncommented line: %moredelim = [is][\color{blue}\bfseries def \mdseries\color{purple}]{def\ }{(}, If I use this one and uncomment the line below I get this result:    It's nearly what I wan't but I cannot add the last, now missing ( in black color.  Does anyone has a solution for this without pretouching the code and add all the @@ symbols?
16238
How do I escape a backtick ` within a code block?  This is probably a duplicate, since I'm sure it's a common concern, but I can't find a question that addresses this specifically.  How do I write List'1 with the "1" character still in the code-text format?
52629
Is there any way I can specify a standard or custom numeric format string to always output the sign, be it +ve or -ve (although what it should do for zero, I'm not sure!)
4153
Is there some easy way to pad Strings in Java?  Seems like something that should be in some StringUtil-like API, but I can't find anything that does this.
44451
The table looks like this:  1|Hunk|First|London 2|Hero|Second|London 3|Will|First|Pow 4|Thomas|Second|Pow 5|Venus|First|Berlin   I want to print the output as:  Berlin|First|venus|5   i want to print only the final line.