General :: Capturing Output Of Command In Vim Editor?
Sep 28, 2010
I have a file which contains a table
row1 ✔ no ✔ no
row2 no ✔ ✔ no
... so on
I want to prefix the number of ✔ to corresponding row If I use the command :.s/✔//gn I get output written like '2 matches on 1 line' How can I extract the '2 matches' in above case ?
View 11 Replies
ADVERTISEMENT
Aug 5, 2011
I run a 3rd party command line utility and it works fine, but sometimes it says "Error blah blah blah... Connection timed out"
I want to script this utility, but I need to not execute the commands in the script if it gives me that connection timeout error.
bash code to capture that response from the utility? Something along the lines of:
Quote:
#!/bin/bash
3rdpartyutil > /tmp/temp.txt
if [ ! -f /tmp/temp.txt]; then
echo no error, run whatever you need to man
fi
rm /tmp/temp.txt
Unfortunately, that doesn't work because the utility outputs non-error information to the screen even when it is successful, so it always outputs something, I never need to see it, but I do need to be able to act upon if some of that text says "error" or "connection timed out"
View 3 Replies
View Related
Jun 2, 2011
I want local programmatic access to ssh output in Mac Terminal. First, I tried redirecting the output of each command to a file. The file was perfect, but of course it was on the remote server, and an sftp for each command output seemed a little.. Next, I tried to Applescript Terminal, but it only gives access to the currently visible text in a tab (i.e. if half the output has already scrolled out of sight, it doesn't get returned - useless).
Last, I tried piping ssh to tee (e.g. ssh user@host | tee output.txt). This almost worked. I have the output in a local file, but there are a lot of unwanted characters mixed in. For example, every time I hit backspace, there's a ^H in the file. There's also text like "[0m[K" which is harder to get rid of.
View 2 Replies
View Related
Aug 6, 2010
I am capturing the response of three URLs which are in file named urls.txt using following command and write response in output.txt file.
####Code############
wget -i urls.txt -q -O - | tee output.txt
###########End of code
Now i am finding the case where url is not responding and that output is not available to me in the file and on console i am getting "Could not connect to host".
Now I want to modify my urls.txt to have two fields:
Name and URL
Example:
URL1 | http://10.0.0.2/xsc/abc
URL2 | http://10.0.0.1/lkj/csv
URL3 | http://10.0.0.5/sdf/plk
I want to execute each url and print there response against each name
Example:
URL1 : CONNECTED
URL2 : NOT CONNECTED
URL3 : NOT CONNECTED
View 2 Replies
View Related
Jul 20, 2011
I've made a simple php wrapper around scp. It works fine, but unlike when I run the scp command straight from the console, there is no output returned. I've tried using passthru(), exec(), system() and shell_exec(), all to no avail. I'm redirecting stderr to stdout already.
For example:
PHP Code:
<?php
$command = "scp -C -r $files $target 2>&1";
exec($command, $result);
print_r($result);
?>
Will scp the files correctly to the server, but doesn't print any output - $result is just an empty array. I'd like to see the output so I can visually confirm that the files have been transferred correctly.
View 1 Replies
View Related
Jan 7, 2010
According to 'man luvcview', if I do this:
Code:
luvcview -o testvid.avi
then luvcview should capture the video to the .avi file. However, when I try it, no output file is created. Grabbing a raw stream or raw frames works fine, but not the creation of AVI files. Am I missing something?
View 6 Replies
View Related
Apr 17, 2010
I would like to capture all output spewed to a terminal session including processes that are terminated that were invoked from a script running in a terminal window. this is beyond capturing just stderr and stdout . for example
{
./script
} 2> stderr.cap 1>stdout.cap
if script is terminated (including because of memory violations) I get spewed output to the terminal I would like to capture that spewing to a file automatically or to a bit bucket /dev/null Is there another filehandle which can be redirected to do this? If so how or is there another way???
View 3 Replies
View Related
Aug 20, 2011
HP Mini 210Fedora 15 Latest updatesGnome 3.0.1In the terminal when I do the following:nm-connection-editorI get the following:command not foundWhere is the nm-connection-editor?
View 1 Replies
View Related
Jul 3, 2009
I am using openSUSE 10.3.When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes).How can I append output of date to a file so I don't need two files?
View 4 Replies
View Related
Dec 23, 2010
I am trying to upgrade PHP on our linux box ( CentOS ) I copied the configure command from the phpinfo and now I want to execute that.I am not able to copy the command from an editor in linux to the command prompt, clicking the wheel om my mouse does not work, neither does shift-insert or ctrl-shift-insert.It does work in the editor itself.Is there a way to do this ?Or is there a way to execute the command in linux while it is in the file ? Like a bat file on Windows ?
View 14 Replies
View Related
Jul 2, 2011
I want to run gsettings list-schemas (which return a list of about 100 names separated by spaces)and somehow direct each name one at a time as the input to this command:gsettings list-recursivelyI've tried it with awk, and standard | piping and also as a string variable strvar=$(gsettings list-schemas) and using the $strvar as the input butam missing something in between I'm sure like for - while or proper syntax of awk etc
View 3 Replies
View Related
Nov 13, 2010
I want to use the output of a previous command as a parameter to another command. For example: to know where "nice" is stored i typed: which nice output: /usr/bin/nice now the second command i typed is: ls -l /usr/bin/nice Is there a way to have a single command like: ls -l which nice ?
View 4 Replies
View Related
Aug 8, 2011
when I type "crontab -e" to edit the file, it is not opening in the editor & showing output as "285". I just wanted to edit crontab, So could anybody please tell me which is the real file of crontab, so I can manually edit that file using vi editor or nano. Or if that default editor is corrupted when I type "crontab -e", how can I change default editor before using "crontab -e" command. I will be waiting for your kind reply
View 2 Replies
View Related
Mar 10, 2011
How default editor can be changed in redhat linux to different editor.
View 4 Replies
View Related
Apr 7, 2010
How to redirect output from dd command to /dev/null ?
View 2 Replies
View Related
Jul 25, 2010
For example, if I type ':pwd' to get the current working directory, I can select the text in gvim but I can't figure out how to copy it to the clipboard. If I try the same in console vim, I can't even select it with the mouse. I would like this to work with all vim commands, such as set guifont to copy the guifont=Consolas:h10:cANSI output.
View 4 Replies
View Related
Aug 27, 2010
i am running ps xo "pid,command" but I can't find my process in the results. I know that the process is running because I run ps ax | grep command-name
View 4 Replies
View Related
Feb 12, 2011
What does the following Shell program do ??: () { :| : &} ; :Warning: My computer got hung when i tried to execute this.Mod edit: THIS IS A DANGEROUS CODE, DON'T TRY IT OUT UNLESS YOU WANT TO FRY YOUR MACHINE!
View 2 Replies
View Related
Apr 28, 2010
i have a variable called hostname which contains hostname of my machine. How would i add the hostname to output of other command . For eg. if a output of command is . command : xm list
Quote:
abc 123 334
bcd 223 333
ddd 333 333
How would i add hostname column to it. My output should look like
Quote:
abc 123 334 hostname
bcd 223 333 hostname
ddd 333 333 hostname
View 1 Replies
View Related
Mar 20, 2010
this is the output of df command on my system
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda8 18073924 4911628 12244184 29% /
udev 642140 308 641832 1% /dev
[code]....
View 14 Replies
View Related
Feb 5, 2010
I have a script that is in Unix. I wanted to know is there any difference between output of ls command in unix and linux
In Unix
Code:
ls -ltr | awk '{print $9}'
In linux output is something similar to
Code:
drwxrwxrwx 2 vinay vinay 4096 2010-02-04 20:31 test
According to above output nothing will be displayed for
Code:
ls -ltr | awk '{print $9}'
ls -ltr | awk '{print $8}' will give test as ouptut in Linux.
I wanted to check the output format for ls -ltr, Anyone using Unix systems may paste a sample output of the command ls -ltr..
View 2 Replies
View Related
May 17, 2011
I write a little script that run top command and clear the output leaving only cpu ram and swap values. If i run the script manually everityng works fine but when i schedule the cript to run every 5 minutes from /etc/crontab all run fine but the output of the top command doesnt appear in the log :
This is the cript :
#!/bin/sh
echo "#############################" >> /var/log/performance.log
echo "" >> /var/log/performance.log
/bin/date >> /var/log/performance.log
[code]...
View 6 Replies
View Related
Aug 9, 2011
I have taken putty session of a server from two separate machines namely HOST1(3 sessions) and HOST2(1 Session) . However w command says there are 5 users
Code:
# w
09:29:36 up 34 days, 15:48, 5 users, load average: 0.62, 4.33, 8.16
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/17 HOST1 09:18 4:26 0.01s 0.01s -bash
root pts/18 HOST1 09:27 1:21 0.00s 0.00s -bash
root pts/21 HOST2 09:29 0.00s 0.00s 0.00s w
root pts/20 HOST1 09:29 1:39 0.00s 0.00s -bash
View 3 Replies
View Related
Jul 6, 2010
How to find out of a filesystem is in readonly mode?
What will the output be from the 'mount' command if a filesystem is read-only?
View 2 Replies
View Related
Mar 17, 2011
I need a tool to analyse the output of sar command. just like sarg which analyses the log files for http , squid etc . I need a similar tool for sar output analysis.
View 3 Replies
View Related
Sep 8, 2010
I want to scan a particular directory recursively and run a particular command with each file as input. For this I am using "find /dir/path". I dont want to write any long script containing loop on the output of "find". I want a single command which will allow me to run a command on each file of the "find" command output.
View 3 Replies
View Related
Feb 15, 2011
I have a requirement to find the files having its name as ack_reply. However, there are many other files in the same directory as these resides. Now I have to remove these files from the folder and retain others after 7 days. So I tried to write the below script with grep command.
find $directory -type f -mtime +7 | grep ack_reply
how can I pass this output to -exec command.
If I am not using grep command my script would be as
find $directory -type f -mtime +7 -exec remove.sh {}\;;
How can I use -exec with grep and find.
View 4 Replies
View Related
Apr 29, 2010
I am creating a script to sync my important documents between two system. I want my script to generate a log file for the last action. can you suggest me a way to achieve this.Question: If I execute the rsync command with -v flag, it will print a lot of messages on the console. Is there any way. So, I can redirect these logs to a file?
View 4 Replies
View Related
Jun 27, 2011
How can I split an output of a command to two terminals? one will get stdout and the other will get stderr. The best I could do is:
On first terminal code...
This works ok but it prints the errors over and over again every time, is there any better way to redirect the errors to another terminal?
View 2 Replies
View Related
Sep 6, 2011
If I grep -nr sumthin * in my source code directory, it also spews out very long lines from minified JavaScript or CSS files. I want to get just the first 80 characters per line. For example, a regular grep gives me this:
css/style.css:21:behavior: url("css/iepngfix.htc")
css/style-min.css:4:.arrow1{cursor:pointer;position:absolute;left:5px;bottom:10px;z-index:13;}.arrow2{cursor:pointer;position:absolute;right:5px;bottom:10px;z-index:13;}.calendarModule{z-index:100;}.calendarFooterContainer{height:25px;text-align:center;width:100%!important;z-index:15;position:relative;font-size:15px!important;padding:-2px 0 3px 0;clear:both!important;border-left:1px solid #CCC;border-right:1px ... etc.
But I'd like to get just this instead:
css/style.css:21: behavior: url("css/iepngfix.htc")
css/style-min.css:4:.arrow1{cursor:pointer;position:absolute;left:5px;bottom:
What Linux command can do this?
View 3 Replies
View Related