Mashed/compressed command line output

This is rather hard to describe, but after installing Arch on a new machine not long ago, I noticed that in the output of certain programs, some characters were partially or entirely hidden behind others.  That is, it appears that certain letters are mostly missing, but little bits of them are still visible behind characters that come later on in the output.  If I select the output with my mouse, and copy and paste somewhere else, the entire output is there...it's just not all visible on the command line.  Though, as I select with my mouse, the specific text my mouse is over becomes visible and other, adjacent characters are hidden.  So far I've seen this running yaourt, as well as in vim (which is really a pain).  I use Konsole.
Here's a screenshot, showing the output of `yaourt -Ss digikam`:
Notice how various text fields seem to run into each other, and the end of each field gets clipped.  As I said, I see the same behavior within vim, so it's not limited to the output of any particular program.  Any ideas what's causing this?  Is it a Konsole thing, or could it be related to X somehow, or maybe something else I haven't thought of?

I am writing a program that runs a load utility via a
class that returns the load utilities output via a
string. There is a certain part of this output which
i need to determine if the program has successfully
completed. I am looking for suggestions on how to
accomplish this. Below is an example of the commands
output.
Rows Read : 30000
Rows Rejected : 0
Rows Loaded : 30000
Rows Committed: 30000What constitutes a successful run?
Might want to take a look at the String.startsWith() and String.indexOf() methods:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html

Similar Messages

  • Capturing command line output to a file possible?

    Hi, i am in need of capturing the command line output to a txt file and need some suggestions on how to do it.
    I have two classes, class A is the one with all the methods and outputs text to the command line (using System.out.print). class B is the one that calls the methods and needs to record the command line output to a file.
    Now the problem i face is not all the output is going to be written to a file and not all the output is going to be displayed on the command line. eg. class B will have a way to select the output mode which is either both to a file and command line or just to a file and display nothing on the command line.
    Is what i am asking even possible? Any suggestions would be great!

    Here is a class I found on the forum that does basically what you need. Just change the code that is updating a Document to write to a file:
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class ConsoleOutputStream extends OutputStream
         private Document document = null;
         private ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
         private PrintStream ps = null;
         public ConsoleOutputStream(Document document, PrintStream ps)
              this.document = document;
              this.ps = ps;
         public void write(int b)
              outputStream.write (b);
         public void flush() throws IOException
              super.flush();
              try
                   if (document != null)
                        document.insertString (document.getLength (),
                             new String (outputStream.toByteArray ()), null);
                   if (ps != null)
                        ps.write (outputStream.toByteArray ());
                   outputStream.reset ();
              catch(Exception e) {}
         public static void main(String[] args)
              JTextArea textArea = new JTextArea();
              JScrollPane scrollPane = new JScrollPane( textArea );
              JFrame frame = new JFrame("Redirect Output");
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.getContentPane().add( scrollPane );
              frame.setSize(300, 600);
              frame.setVisible(true);
              System.setOut( new PrintStream(
                   new ConsoleOutputStream (textArea.getDocument (), System.out), true));
              System.setErr( new PrintStream(
                   new ConsoleOutputStream (textArea.getDocument (), null), true));
              Timer timer = new Timer(1000, new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        System.out.println( new java.util.Date().toString() );
                        System.err.println( System.currentTimeMillis() );
              timer.start();
    }

  • Getting command line output dynamically

    I am executing one command line argument through WPF application but not getting any output of command line execution. But if I will execute same command through command line manually then getting out put. I am using synchronous operation and below code.
    System.Diagnostics.ProcessStartInfo procStartInfo =
                        new System.Diagnostics.ProcessStartInfo("cmd", "/C " + commandlinearg);
    procStartInfo.UseShellExecute = false;
    procStartInfo.CreateNoWindow = true;
    procStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    procStartInfo.WorkingDirectory = strToolsPath;           
    procStartInfo.RedirectStandardOutput = true;
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.StartInfo = procStartInfo;
    proc.Start();
    result = proc.StandardOutput.ReadToEnd();
    proc.Close();
    --Mrutyunjaya

    Hi Magnus, I am using synchronous operation like below
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.StartInfo = procStartInfo;
    proc.Start();
    result = proc.StandardOutput.ReadToEnd();
    proc.WaitForExit();
    if output is very huge then in that case is it required to collect in a huge buffer or below code can collect the out put 
    result = proc.StandardOutput.ReadToEnd();
    because I am using also WaitForExit but still I am not getting out put whereas using same code i am getting output for some commands(which gives less output). 
    Mrutyunjaya

  • Parsing java command line output to a gui

    Dear All,
    I am trying to implement a search engine for a project, i have a java file called Searcher.java, which searches for a particular text or sentence and gives the output based on the number of hits on a particular document, the document with the max hits is displayed first and so on,all the documents are are stored in a text file, I am trying to create a GUI for this file, the gui would consist of a text box,submit button,a list and a text area , when a user enters the text to search all the entries are displayed in the list box and upon clicking the individual item in the list the description should open up in the text area.
    The problem i am encountering is that i am not able to parse the output of the searcher.java file onto the GUI, i have no clue as to how to implement it , i would really appreciate it if anyone could help me out.
    the code for Searcher.java is as follows
    import java.util.*;
    public class Searcher {
    /** Specify the work directory !! */
    private static final String rootDir = "C:/HR/GUIAssign/";//on PC
    // private static final String rootDir = "/research/gm/Java/IR/"; // on Unix
    private static final String stopWordFile = "iStopWords.txt";
    private static final String docCollFile = "iDocColl.txt";
    private static final String invertedIndexFile = "ioInvertedIndex.txt";
    private StopWordSet stopWords = new StopWordSet(rootDir + stopWordFile);
    private Stemmer stemmer = new Stemmer();
    private TextTokenizer tok;
    private TextParser parser;
    private InvertedIndex inv;
    /** Creates a new instance of Searcher */
    public Searcher(TextTokenizer tok, TextParser parser) {
    this.tok = tok;
    this.parser = parser;
    ReaderWriter rw = new TextFileReaderWriter(rootDir);
    inv = rw.readInvertedIndex(invertedIndexFile);
    List search(String query) {
    System.out.println("\nSearching for <" + query + ">.");
    List hits = new ArrayList();
    int nbOfDocs = parser.getNbOfReadDocs();
    System.out.println("\nSearching for <" + query + "> among " + nbOfDocs +
    " documents.\n");
    double scores[] = new double[nbOfDocs]; // initial values 0.0
    String term;
    tok.setText(query);
    while(tok.hasMore()) {
    System.out.println("\nNext term: ");
    term = tok.nextToken();
    System.out.println(term);
    if(stopWords.contains(term))
    continue; // this terms can be ignored
    term = stemmer.stem(term); // apply the stemmer to get the root
    System.out.println("\n\nInfo on the term \"" + term + "\":");
    IndexTerm indexTerm = inv.getIndexTerm(term);
    if(indexTerm == null)
    System.out.print("Not in the vocabulary.");
    else {
    System.out.print("It appears " + indexTerm.getTermFreq() + " times, in "
    + indexTerm.getDocFreq() + " documents:\t");
    Iterator itr = indexTerm.getIterator();
    while(itr.hasNext()) {
    DocFreq docFreq = (DocFreq) itr.next();
    scores[docFreq.getDocId()] += docFreq.getFreq() /* / indexTerm.getDocFreq() */ ;
    // create hits from documents that have non-zero scores
    for(int i = 0; i < nbOfDocs; i++)
    if(scores[i] > 0.0)
    hits.add(new Hit(i, scores));
    // sort them in descending order of scores
    Collections.sort(hits, new Hit.CompareByScore());
    return hits;
    * @param args the command line arguments
    public static void main(String[] args) {
    TextTokenizer tok = TextTokenizer.getTokenizer("alpha");
    TextParser parser = new DummyParser(rootDir, tok);
    Searcher searcher = new Searcher(tok, parser);
    List hits = searcher.search("trade and board coffee, stock x is common");
    Iterator it = hits.iterator();
    while(it.hasNext()) {
    Hit hit = (Hit) it.next();
    int index = hit.getDocIndex();
    Doc doc = parser.getDoc(index);
    System.out.println("\n\nDoc " + index + " has a score of: " +
    hit.getScore() + "\n*** " + doc.getTitle() + " ***\n" +
    doc.getText());
    this code runs perfectly and gives the output on the command line
    the code for the GUI is as follows
    import java.awt.* ;
    import java.awt.event.* ;
    import javax.swing.* ;
    import javax.swing.event.*;
    public class HRSearch extends JFrame implements ActionListener {
    // keep references to all event sources
    private JLabel searchLabel;
    private JTextField searchField ;
    private JButton submitButton ;
    private JScrollPane searchScrollPane;
    private JTextArea textArea ;
    public HRSearch()
              Container contentPane = /*this.*/getContentPane( ) ;
              JPanel submitPanel = new JPanel();
              submitPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
              searchLabel = new JLabel("Search: ");
              searchLabel.setEnabled(false);
              submitPanel.add(searchLabel);
              searchField = new JTextField("", 20) ;
              searchField.setEditable(true) ;
              searchField.addActionListener(this) ;
              searchField.setEnabled(false);
              submitPanel.add(searchField) ;
              submitButton = new JButton("Submit") ;
              submitButton.addActionListener(this) ;
              submitButton.setEnabled(false);
              submitPanel.add(submitButton);
              contentPane.add(submitPanel, BorderLayout.NORTH);
    JPanel mainPanel = new JPanel() ;
                   mainPanel.setLayout(new FlowLayout(FlowLayout.LEFT)) ;
              JList searchList = new JList() ;
              // searchList.setEditable(false) ;
              searchList.setVisibleRowCount(20) ;
              searchScrollPane = new JScrollPane(searchList);
              mainPanel.add(searchScrollPane) ;
              textArea = new JTextArea("", 20, 40) ;
              textArea.setEditable(false) ;
              mainPanel.add(new JScrollPane(textArea) /*, BorderLayout.CENTER */) ;
              contentPane.add(mainPanel, BorderLayout.CENTER) ;
    public void actionPerformed(ActionEvent e) {
    String text ; // response to action event
    Object source = e.getSource( ) ;
    if (source != searchField && source != submitButton)
    return; // not interested in other actions
    // get text, trim leading and trailing spaces
    text = searchField.getText( ).trim() ;
    try {
    textArea.setText(textArea.getText() + "\n" + " " );
    catch(NumberFormatException exc) {
    JOptionPane.showMessageDialog(
    this, // address of "parent" or "anchor" frame
    "Not a number !", // the error message
    "Number Format Exception", // title of this modal dialogue
    JOptionPane.ERROR_MESSAGE // nature of this dialoge
    public static void main(String args[]) {
              final JFrame f = new HRSearch();
              // f.setBounds(100,100,500,450);
              f.pack();
              f.setVisible(true);
              f.setDefaultCloseOperation(EXIT_ON_CLOSE);
    i am stuck at this point and dont know what to do , please help me out.
    regards
    harsha

    I'm not positive I understand your problem... but let me recap what I think it is, then provide a solution:
    Your searched program can be run from the command line, and prints out (using system.out) the data you want. But NOW you want to create a GUI class, that intercepts that output, and displays it on the screen, and you can't because its going to the output stream and you're GUI isn't able to get it.
    If this is the case, what you can do is add two constructors to your Searcher class:
    public Searcher()
    this(System.out);
    public Searcher(OutputStream out)
    this.out = out;
    The idea being, that if you don't specify an output stream, the output goes to the console like normal. But if you do specify an output stream, the data gets fed back to you. So then in your GUI, you can do some binding of PipedInputStream and PipedOutputStream so when the Searcher class prints out, it comes right through the pipe into your GUI where you are waiting to read it.
    If this wasn't your problem, sorry :(
    Best,
    -Riyad

  • Command Line Output Directory

    I am trying to generate my help files through the commanline utitlity via a bat file.
    Here is my bat file...
    rem Generates the System output files
    :START
    "c:\Program Files\Adobe\Adobe RoboHelp 8\RoboHTML\RHCL.exe" "c:\Projects\myProj\1.0.0\Development\HelpFiles\MyHelp.xpj" -o
    "c:\userName\Desktop\RoboHelpOutput" -g "c:\userName\Desktop\RoboHelpOutput\log.txt"
    :END
    When I run this, it successfully generates the output files, but it does not generate it in the "c:\userName\Desktop\RoboHelpOutput" directory. Instead, it uses the directory I pointed it at when I generate the output through the RoboHelp UI. I need to figure out why this is ignoring the -o Destination tag in order to be able to work locally and have the help files generated with our automated builds.
    Please Help!!!!
    Thanks in advance!
    hmaprk

    Hi - we are having the same issue. Regardless of what we specify as the output folder, the help file always generates the output on the drive we previously specified in the SSL file.
    SSL:
    <element name="DestinationProjectName" value="X:\doc_4x\html\apps\output\pr\flexi\fpr32.chm" />
    We tried to eleminate the X: to see where the file will generate to. This is the path that showed up on the first wizard screen when I went to generate in RH a few minutes later:
    X:\doc_4x\html\apps\projects\pr\doc_4x\html\apps\projects\pr\doc_4x\html\apps\output\pr\fl exi\fpr32.chm
    Any help in resolving our command line build issue is greatly appreciated!

  • How to display Runtime.exec() command line output via swing

    Hi all, I'm new to java but have a pretty good understanding of it. I'm just not familiar with all the different classes. I'm having trouble capturing the output from a command I'm running from my program. I'm using Runtime.exec(cmdarray) and I'm trying to display the output/results to a JFrame. Once I get the output to display in a JFrame, I'd like it to be almost like a java command prompt where I can type into it incase the command requires user interaction.
    The command executes fine, but I just don't know how to get the results of the command when executed. The command is executed when I click a JButton, which I'd like to then open a JFrame, Popup window or something to display the command results while allowing user interaction.
    Any examples would be appreciated.
    Thank you for your help in advance and I apologize if I'm not clear.

    You can get the standard output of the program with Process.getInputStream. (It's output from the process, but input to your program.)
    This assumes of course that the program you're running is a console program that reads/writes to standard input/output.
    In fact, you really should read from standard output and standard error from the process you start, even if you're not planning to use them. Read this:
    When Runtime Exec Won't

  • Command Line Output Parsing

    I am writing a program that runs a load utility via a class that returns the load utilities output via a string. There is a certain part of this output which i need to determine if the program has successfully completed. I am looking for suggestions on how to accomplish this. Below is an example of the commands output.
    Rows Read : 30000
    Rows Rejected : 0
    Rows Loaded : 30000
    Rows Committed: 30000

    I am writing a program that runs a load utility via a
    class that returns the load utilities output via a
    string. There is a certain part of this output which
    i need to determine if the program has successfully
    completed. I am looking for suggestions on how to
    accomplish this. Below is an example of the commands
    output.
    Rows Read : 30000
    Rows Rejected : 0
    Rows Loaded : 30000
    Rows Committed: 30000What constitutes a successful run?
    Might want to take a look at the String.startsWith() and String.indexOf() methods:
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html

  • Display command line output

    In my program LabVIEW calls an executable using a batch file and this executable returns a string. Is there a way for LabVIEW to be able to view this output string?

    hi
    I do not know how your batch files run, but you should get it run properly (with "wait until completion = False) before setting it to TRUE.
    If your batch files do not even run correctly (with "wait until completion = False), it will hangs when your run the system exec.vi (with "wait until completion = TRUE).
    Hope this is not too confusing....
    ... as it's late now... and Zzzzz..
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com

  • Displaying command line window in a tab

    I have to display a graphics screen of a simulator that is run through a batch file, in a tab. Is it possible? If yes how might I do so?
    Thanks for you time!

    Is your problem solved yet? If not take a look at this page http://www.labnol.org/software/tutorials/copy-dos-command-line-output-clipboard-clip-exe/2506/
    It might help you
    By using a property node you can copy content from clipboard
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • What is the command line equivalent of the *compress* tool in *Finder*

    I have an automatic build setup for our iPhone Apps. The one issue i face everytime is that the zip file that i create in the build using zip command is always rejected by iTunesConnect server as invalid binary. When i compress the .APP folder manually using Compress from the *Finder menu*, that archive is always accepted. The size of the zip files generated is slightly different.
    Does anyone know what would be the command line equivalent of the Compress used by the Finder ? I want to automate this process so that someone does not have to do a manual compress before uploading it to iTunesConnect.
    Thanks in advance,
    -TRS

    a Mac user wrote:
    That is odd, are you sure you are using the command line correctly then? Because zip-ing from the command line should be the exact same one as from the utility in OS X.
    It's not the same, though. As someone else pointed out, the Finder uses a program called "Archive Utility.app", found in "/System/Library/CoreServices". A quick look at the binary shows that it uses the following Unix command line apps:
    /usr/bin/macbinary
    /usr/bin/file
    /usr/bin/tar
    /usr/bin/applesingle
    /usr/bin/binhex
    /usr/bin/ditto
    /usr/bin/gunzip
    /usr/bin/bunzip2
    /usr/bin/uudecode
    /usr/bin/atos
    I would have to look into how iTunesConnect accepts files.
    iPhone apps are signed binaries, so if one byte is different when they arrive at the app store, they won't be accepted. The command line zip leaves out some information and so the package appears to have been tampered with and they're rejected.
    charlie

  • Capturing the output of a os command line

    I need to capture the output of a os command line executed from one java program and I don't know how can do it.
    For example:
    Runtime.getRuntime().exec("hostid");

    Your suggestion worked very well, just in case that this could interest somebody, this is the complete solution
    Thanks for your help
    import java.io.*;
    public class HostID
    public static void main(String args[]){
    try{
    InputStream in = (Runtime.getRuntime().exec("hostid")).getInputStream();
    byte[] arreglo= new byte[200];
    int cantidad = in.read(arreglo);
    System.out.println(new String(arreglo,0,cantidad));
    } catch (IOException ioe){System.out.println(ioe.getMessage());}
    }

  • Unix command Line input and output

    Has anybody used Forte for now window application. Passing values through
    command line and get put as a return value. I am able to call Forte and
    pass input values but I do not know who to get the return value. Here is
    the shell script that I am running:
    #!/bin/csh
    # Ensure that the correct number of parameters were supplied #
    if (${#argv} < 2) then
    then
    echo "USAGE: ecapp Method Number Parm1 Parm2"
    exit 1
    endif
    ftexec -fi bt:$FORTE_ROOT/userapp/mwapp/cl0/mwapp_0 -fnw -fterm $1 $2
    The start class will return a string value after processing the request. I
    can use task.lgr.putline to output to the screen but that is not what I
    would like to do. I want to get the return value assigned to a variable in
    the shell script. One thing I do not know is that if Forte return a string
    that the script can use. Any help would be appreciated.
    thanks in advance
    ka
    Kamran Amin
    Forte Technical Leader, Core Systems
    (203)-459-7362 or 8-204-7362 - Trumbull
    [email protected]
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hi,
    Did you try to set Task.Part.OperatingSystem.ExitStatus ? But, the ExitStatus is an integer.
    If you really need a string, I would use ExitStatus to know how it finished and an environment variable (Task.Part.OperatingSystem.SetEnv() to position it in your Tool code) to read the string back in the script.
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    Url : http://perso.club-internet.fr/dnguyen/

  • Compress/zip files from the command line in Windows 7?

    In Windows 7 is there a native way to compress or zip files from the command line?  I'd like to do it without installing any third-party utilities such as 7Zip.

    I fully agree that Compact is not the answer. There are additional concerns with the Compact command. It enables disk compression which is a total no-no. Very bad! It makes your computer very slow and is quite difficult to undo. The only time anyone should
    use this command is when they're removing disk compression because someone turned it on to save space.  Turning this off has to be done by booting into the recovery console, if my memory serves me correctly, and it's a real nuisance.  So
    definitely no to the Compact command.
    If you wanted to compress files before sending them to another drive, or over a network, or by email, then Compact wouldn't actually help at all because the files have to get uncompressed whenever they're accessed, especially before sending them anywhere. 
    When I say accessed, I mean that just looking at a file triggers the OS to decompress it in the background and present you with an uncompressed version of it then letting you change it and recompressing it again for storage every single time you access the
    file, which is why your machine gets slower.  If you have folders or files that have blue text instead of black, then you've probably already made this mistake.
    I would also like to know if there is a built-in command for zipping files/directories, or, if there isn't such a thing built into Windows, then I would like to know if this is feature is accessible through Visual Studio, which would be just as good as having
    a command-line program for those of us that do a bit of programming.
    If anyone knows if MS provides such a feature, either by command-line or through an API, then I'd love to hear about it.  Good luck to those of you that have disk compression turn on.

  • How to execute some code in command line, and read its output?

    I'v found here http://www.sap-advisor.com/abap-coding/how-to-execute-operating-system-commands-from-within-sap/ that I can execute commands from the windows command line for example inside SAP.
    But I want to take it one step further and read its output. is it possible?

    Hi RagnaRock,
    one possible approach can be outputting the results of the command into a text file (i.e. "command >result.txt"), and then read this file from SAP/ABAP.
    I hope this helps. Kind regards,
    Alvaro

  • RH9 - Any idea why generating printable output from the Command Line doesn't include images?

    I have a batch file that creates a printable output of our main documentation broken up into 36 separate documents, 1 per chapter. Each chapter is a separate layout. I realize that RH has its own Batch building process, but the reason for me doing it through the command line via a batch file (.bat) is that RH keeps taking focus from my mouse and it makes it difficult to do any other computer work while the RH project generates the printable output for those chapters.
    Anyway, RH's Batch build works fine.
    But the command line for printable output does not include any of my images in the printable output. I don't know why. The document generates with all the topics fine, but the images are missing. No placeholder box in the resulting Word doc, they just simply weren't included. Has anyone else seen this? Any way to fix it?

    All,
    I thought it may be related to spaces in the path in which the script was called from. I tried having the ODBC command script in another directory but the same thing happens. It will give me the "CONFIGSYSDSN: Unable to create a data source for the 'Oracle in OraClient10g_home1' driver: Could not load the setup or translator library with error code -2147467259". As soon as the script is done running I can manually double click the script and it adds the DSN fine.
    Thanks,
    Clif Bridegum

Maybe you are looking for

  • No Black Ink with a new cartridge and new printer and was working

    I put in all new cartridges and everything was working just fine. I printed two black copies and then went into Settings to change to a lighter shade. Now no black copies at all. I went back into Setting and changed it to a darker shade (4) and still

  • I need to reinstall Acrobat XI within Creative Cloud.

    I was having problems getting webpages to properly display PDF files. They wouldn't show. So, I uninstalled Acrobat XI. I want to reinstall it now. But, it's not letting me. Adobe Application Manager keeps telling me that Acrobat is "up to date." Wel

  • Need information on how to create Idoc Inbound Interfaces for Business Sys

    Hi, I'm losing it. Can anyone point me to some documentation or an example of how to create inbound interfaces for Business Systems in PI 7.1. Here's the scenario I'm working on a B2B integration process which sends inbound idocs to an ECC 6.0 system

  • Can't reopen a activex player I a popup.

    Hi I have a popup that plays a video file. First time I open it works, but not the second time. I keep the refrerence in a shift register. If I never close the popup I don't get the problem. I think labview is messing with the reference when the wind

  • SAP Upgradation from 4.5B to ECC 6.0

    Hi all, We need to upgrade from 4.5B to ECC 6.0. Gathered all the information abt. the 4.5 B system...Its on AIX using ORACLE. I want to know few more info. with your help. i have access to the system through GUI, but didnt have OS level access.. 1.)