General :: Restrict Output To Display One File Each?

Jul 27, 2010

I use 'grep -Ri "mypattern" .' to search for all files in the current directory recursively that contain "mypattern". But this command returns every single occurence, so that if a given file has several occurences of the pattern, the screen fills up pretty quick. More than likely, there's a way to restrict the output so that it only displays each file once, no matter how many occurences it contains, but I couldn't find how to do it.

View 2 Replies


ADVERTISEMENT

General :: Using Cut On File Full Of Ls -l Output To Display Only Filenames?

Oct 7, 2010

I have a file that contains "ls -la" output. I would like to display only the filenames, none of the other information before it such as permissions, ownership, size, and date.Would the cut command be the best way to hit this, or should I use Vim or sed?

View 6 Replies View Related

General :: Display AWK Output In Perl

Feb 8, 2011

I am trying to use awk command in perl. Below is my awk comamnd which works alone.
awk '{Easttot=Easttot+$1} END {print Easttot}' MessagesProcessedEAST2Cnts.dat
I would like to use this awk's output in shell script. I am using system command like below to get the out put. But it is not working.
$Output = system("awk '{Easttot=Easttot+$1} END {print Easttot}' MessagesProcessedEAST2Cnts.dat'");

View 3 Replies View Related

General :: Restrict File Access To The Root User Of One Particular Host?

Aug 12, 2010

If there is a general NFS share in the LAN and for example this share has three files - a, b, c is there any way to restrict file access to the root user of one particular host(falcon) in the same LAN environment while the normal users from the same host(falcon) should be able to access the NFS share & files a, b, c.

View 1 Replies View Related

General :: Restrict Root User To Delete A File Or Directories?

Jan 20, 2011

is there any way so that we can restrict root to delete a file/directories and What is extended file attributes.

View 12 Replies View Related

General :: How Display Part Of An Output Stream

Feb 4, 2011

Though I have little experience in the past, i just can't get to work what i have in mind.i want to display part of an output stream.

cat sample.xml
<packet or="recv" ljid="d.sample@test.local/" ts="20110204T15:02:55"><message from='j.sample2@test.local/' to='d.sample@test.local' type='chat' xml:lang='en' id='sd61'>

[code]...

View 4 Replies View Related

General :: Windows - Getting WGET To Display A Less Verbose Output?

Jun 16, 2011

Is it possible to get WGET to only show download progress e.g. download bar, opposed to all of the connection info, as it does look a little ugly on the client side, is this possible to do?

View 2 Replies View Related

General :: Unable To Display Output Using Awk In Array Iteration?

Jul 29, 2010

My script is not diaplying output as it contains awk while iterating over the array. My script is as follows:

shortcodes=( "56882" "58585" "58888" "57575" "57677" );
for shortcode in ${shortcodes[@]}
do
echo "`awk -F"|" '/ShortCode=tel:$shortcode/ { arr[substr($2,1,4)]++ } END { for( no in arr) { print no , arr[no] } }'

[code]....

View 4 Replies View Related

General :: Display Specific Block Of Contents Or Lines In Output?

Apr 23, 2010

Consider a situation in which you want to display only specific lines of contents from a file or of a command's output. Yes, we have head and tail commands. But, how to view all the lines of a file except the last one or vise versa when we don't know the count of lines in advance?

Consider this output:

Code:

[root@localhost ~]# ps au | grep bash
root 6316 0.0 0.0 4672 1440 tty1 Ss+ Apr22 0:02 -bash
root 20847 0.2 0.0 4672 1432 pts/0 Ss Apr23 0:12 -bash
root 21167 0.0 0.0 3920 660 pts/0 S+ 01:00 0:00 grep bash

Here, I don't want the last line (in italic) to be included in the result since the last line is due to "grep bash" in the devised command "ps au | grep bash". Well, we can rewrite the devised command:

Quote:

"ps au | grep bash | head -n 2"

But, again, here we are specifying the count of lines to be included. But, in the presented problem we don't know any count in advance!

View 6 Replies View Related

General :: Limit Video Output To A Section Of A Display And Leave The Rest Blank

Feb 22, 2011

The video projector I have to use this week projects an image too large for its screen and spills over on every side.

Fixing the physical setup is not possible or at least unlikely for the moment: the only solution is to carefully resize and position windows so that they display in the visible part of the screen - using full-screen mode is out.

Is there a way around this via software, using xrandr for example?

# xrandr doesn't have a padding option...xrandr --output VGA1 --mode 1360x768 --left-of LVDS1 --padding 200

View 1 Replies View Related

General :: Data From Input File To Be Taken And Send To Output File?

Jul 24, 2010

I am new to shell scripting.What i am trying is to write a shell script which take the input file and output should like as mentioned below.Output file should have data till SOK (marked in red)from every second line and then the selected data(marked in green) from 4th line.So selected data from 2nd and 4th line in one line of O/P file and then similarly selected data from 6th and 8th line in second line of O/P file.Input File:

3c3
< c1111;11.11.11.11;pOK;SOK:abcde;Universe:aa
---

[code]...

View 14 Replies View Related

General :: Script To Ftp A File To Remote Machine - Log The Output To A File?

Feb 5, 2010

I am using below script to ftp a file to remote machine

Code:

#!/bin/bash
ftp -nv <<EOF
open ${SERVER}

[code]....

When I execute the above file its working fine and displaying output on to the screen. How can I log the output to a file?

View 7 Replies View Related

General :: Get Output File From A Master File?

Aug 3, 2010

having following problem in linux environment.I have a following basic file with name " BASEFILE", as shown example below :

sl.no pol.no name status loan
1 123 rama FORCE 500
2 234 jama LAPSE 800

[code]...

View 12 Replies View Related

General :: Shell Scripting \ (test If A File Is Empty, If It Is Then Display "file Is Empty" Otherwise Display "file Is Not Empty")?

Oct 5, 2010

I am a final year student doign Computer systems engineering and just been introduced to linux. While still strugling to catch up with the commands, I am now given an assignment under shell scripting.I seriously am strugling to understand this question, can you please assist me.Here follows the assignment:

Operating Systems III
Some tips
e.g. (test if a file is empty, if it is then display "file is empty" otherwise display

[code]....

View 10 Replies View Related

General :: Getting The Name Of The Output File?

Nov 2, 2009

have a doubt, suppose in the script i include an exe type of file for ex. ./a.out, which takes input as a pdb file namely 1sn3.pdb, now i want my output text file to contain the name 1sn3.txt , how do i do that using the shell script

View 8 Replies View Related

General :: Display File From Line # To End Of File?

Oct 27, 2010

I know how to display contents at the end of beginning of a file or even at specific lines but how to you display a file from line # to the end of the file?

View 5 Replies View Related

Ubuntu :: Restrict File Access With Authz_owner?

Jun 9, 2010

I'm running a Virtual Box with Ubuntu 9.10 and I'm experimenting with Apache 2.2.12I would like to use the authz_owner module but it is not possible for me to access http://localhost/~b/private/"b" is my username and "private" is the directory definded in the httpd.conf file.My httpd.conf file:

Code:
<Directory /home/*/public_html/private>
AuthType Basic

[code]...

View 2 Replies View Related

General :: Saving Awk Output To File?

Feb 2, 2010

I have a problem with saving output from awk to a file. The commands I tried:

Code:

$ top | awk '/Cpu|Mem/ {if ($1 ~ /Cpu/) {printf strftime("%H:%M:%S")" "; printf strtonum($3)" ";} if ($1 ~ /Mem/) {printf ($5/$3)*100; printf "
";}}' > file.out

and

Code:

$ top | awk '/Cpu|Mem/ {if ($1 ~ /Cpu/) {printf strftime("%H:%M:%S")" "; printf strtonum($3)" ";} if ($1 ~ /Mem/) {printf ($5/$3)*100; printf "
";}}' &> file.out

In both cases file.out is empty. What am I doing wrong?

View 2 Replies View Related

Programming :: Output The Display In C++?

Feb 8, 2010

i am having problem with displaying my text. my text file is displayed in such a way and is called test.......

Code:

Sam Worthington ... Jake SullyasZoe Saldana ... NeytiriasSigourney Weaver ... Dr. Grace AugustineasStephen Lang ... Colonel Miles QuaritchasJoel Moore ... Norm Spellman (as Joel David Moore)asGiovanni Ribisi ... Parker SelfridgeasMichelle Rodriguez ... Trudy ChaconasLaz Alonso ... Tsu'teyasWes Studi ... EytukanasCCH Pounder ... MoatasDileep Rao ... Dr. Max PatelasMatt Gerald ... Corporal Lyle WainfleetasSean Anthony Moran ... Private FikeasJason Whyte ... Cryo Vault Med TechasScott Lawrence ... Venture Star Crew Chiefmore

What i am trying to do is for the program to read "as" and then from there start a new line... thus the expected output is...

Code:

Sam Worthington ... Jake Sully
Zoe Saldana ... Neytiri
Sigourney Weaver ... Dr. Grace Augustine

[code]....

I keep getting the error saying ...

Code:

editmain.cpp.98:error: initializer fails to determine size of 'str'

what does this mean, and how can i be able to format my file in the way i want?

View 2 Replies View Related

Ubuntu Security :: Using Apparmor To Restrict File Browser?

Sep 21, 2010

I am trying to use apparmor to restrict my file browser, which is Thunar to only let me view the files that are in the home directory and also removable media.I tried following the apparmor sticky with no success.I created the profile and tried editing it and it either started and let me do pretty much everything or did not start at all. Would it be possible for someone to help me step by step to set up a profile for thunar that would only show the home directory and removable media.

View 2 Replies View Related

General :: How To Print Command Output To A File

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

General :: Redirecting Command Output To File?

Sep 19, 2011

This seems so simple when doing it from command line but I'm not able to accomplish it inside a script. I am trying to put output of following command into a text file:

CMD= mysql -uroot -psecret -e 'SHOW SLAVE STATUS G;'
FIL=~/replication-`date +%F`.txt
MAILTEXT=~/mailtext.txt
touch $FIL
$CMD > $FIL

Where FIL is a variable that contains path of the file to which to output command. I am running this command in a shell script from where I want to email contents of $FIL as attachment using mutt. But I am always getting 0 byte file. Also if I examine in directory the file is of 0 byte length.

View 3 Replies View Related

General :: How To Redirect The Output To Different Column In .csv File?

Apr 25, 2011

I was trying to redirect the output of two variables to different columns of a .csv file in MS excel like this,

Code:
echo "$a $b" > abc.csv
But I am getting both $a and $b in the same column, is there anything I can use instead of to move the value of $b to the next column? Or is there a good different approach to do it?

View 2 Replies View Related

General :: Output Pid's From Ps To A Comma Delimited File?

Apr 7, 2010

need to monitor pecific processes over a time frame in terms of the amount of memory and cpu usage it utilizes. I can do this using the top -p <pid> option and using ps to retrieve the pid's. However, seeing that the pid's might differ and it needs to be run on about 13 different machines, I would like to write a script for this that can be run at set intervals. My problem that I have is this:

- When running top -p <pid> I can specify a comma seperated list of the processes required to monitor at that specific time.

- I can use ps -ef | grep <process> | grep -v grep| awk '{ print $2 }' to retrive the list of pid's and output this to a file.

However, how can I output these to the file as a comma seperated list without having to manually do this every time? The reason for this is (an example), lets say I want to monitor the cpu and memory usage of postgresql as well as all its child processes, then I would ps grep for postgres and get the list of pid's for instance.This list then needs to be passed to top -p as a comma seperated list of pid's I suspect that awk or sed might have some options available for this but I do not know this well enough.

View 11 Replies View Related

General :: E-Mailing Whole Output Of A File With Crontab

May 3, 2011

I have this code that is 'bashed' regularly with crontab and basically it will send me an E-Mail of most of the output but it misses out some of it!

Here is the crontab code to automatically run the script:

Code:

So that sends me an E-mail with most of the output of the following code:

Code:

It sends me everything up to echo "*******" "Begin compressing and transferring files" "*******" but it wont output the tar bit.. so it should give me a list of files that have been tarred.

View 1 Replies View Related

General :: Send Output To Both The Screen And A Txt File?

Jan 29, 2010

I am currently using this command

Code:

apt-get install samba --force-yes -y > /sambainstall.txt This suppresses the screen output and sends it all to a text file, how do I have both?

View 2 Replies View Related

General :: Check The Output Of Assembly File?

Jan 14, 2011

I have a small doubt regarding Assembly file compilation. I have two .s files. When I compile two .s files I am getting corresponding .o files. But when I compare the both .o files with diff command, it is resulting that two files are differing. How could/ what are commands we should use to understand the difference between two .o file's output.

View 4 Replies View Related

General :: Command To Overwrite File With Sed Output?

Jan 5, 2010

For example I want a file to be processed by sed, and then overwrite the file with sed's output. I would try this:
Code:
sed '<regex goes here>' myfile > myfile
But it doesn't work as expected, instead it empties the file (I am thinking that as the first byte comes out of sed, it overwrites the whole file and sed has nothing more to do). How can I make this work?

View 14 Replies View Related

General :: Meaning Of File Command Output?

Feb 27, 2010

I used the following command

Code:
file /usr/bin/mawk
Output is

[code]...

View 4 Replies View Related

General :: Primitive Way To Output A File To The Printer ?

Jun 13, 2011

What is the most primitive way to output a file to the printer? I mean data transfer from the file to the printer. I suppose it must be 'cp some_file /dev/<printer device>. For the console, I know the devices are /dev/ttyN, N= 1,2,... But I do not know what are the devices for the printer.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved