Software :: Compare $var With Content Of File?

May 20, 2011

I got a file with a list of subnets like this:

10.50
10.51
10.62
10.121

then I cnf=`ifconfig` thus giving me the config of the NICs.after that I want to compare the $cnf to see if the value of it is listed in the file and if it is do things.There might also be something better to use then the 'ifconfig'but it worked so I just stuck to it First I just had one subnet but now it's starting to grow and I wanna make a list instead of having them all listed in the if-statement.

View 14 Replies


ADVERTISEMENT

General :: Compare Directory Content That Has Since Been Updated?

Jul 20, 2011

We copied the directories/files from one filesys1 to filesys2 and since that initial copy have further added more directories/files to filesys2 from another source. How can we compare filesys1 to filesys2 to make sure all files/directories were copied successfully to filesys2? I would like a way to check filesys1 against filesys2 and only show/output when something is missing from filesys2 that exists in filesys1 and not report the additional/extra directroies/files that have been copied to filesys2.

View 3 Replies View Related

General :: Dividing Content Of One File By Content Of Another?

Apr 12, 2011

If you have the value 100 in File1 and the value 5 in File2, how do you write a script to divide the 100 in File1 by the 5 in File2 in Linux Bash Shell?The operating system I am using is Ubuntu 10 and object is to write a script to accomplish this task.

View 5 Replies View Related

General :: How To Compare Two Columns In A File

Mar 29, 2010

I am trying to write a script which compares a log file with reference file. The log file has a table, the LHS of the table are constants strings and RHS of table values changes if there are any changes in configuration.code...

Here I am looking for a script which compares test.log file ( whose RHS data-types are known prior whether it is digit or string) with test.Ref which is reference file for test.log file. It will be really helpful for me if any of you give some idea about writing this script.

View 2 Replies View Related

General :: Compare File Timestamp In Bash?

May 6, 2010

How do I compare the timestamp of two files? I tried this but it doesn't work:

file1time=`stat -c %Y fil1.txt`
file2time=`stat -c %Y file2.txt`

[code]....

I printed both the time stamps, in order and it gives me

1273143480
1254144394
./script.sh: line 13: [1273143480: command not found

So basically if comparision is not working, I guess. Or if there is any other nice way than what I am doing, please let me know.

Edit: There was no space in between if, so changing it to this works:

if [ $file1time -gt $file2time ]

View 3 Replies View Related

General :: Compare Two File - Information About Software ?

Nov 16, 2010

I have many files with info about soft, installed on remote machines.

I need to compare this file with template (soft than must be installed) and output file must content info about software that's not installed.

Code:

Code:

output must be software_name2, becouse it is not installed, but software_name3.2 is good enough becouse version is more than we need.

So, the task is to show lines that is in template and not in source, using simple regular expressions

I use grep

Code:

or

Code:

But it shows me only lines that is in source and not in template etc...

View 1 Replies View Related

CentOS 5 :: Script To Compare File To /etc/passwd?

Nov 10, 2009

I have a list of locked accounts, called lockedusers, how can I with a bash script compare it to /etc/passwd on the server and print them out if they match?

View 2 Replies View Related

Programming :: HUGE Files - Compare A List Of Patterns From One File And Grep Them Against Another File And Print Out Only The Unique Patterns?

Aug 13, 2010

I am trying to compare a list of patterns from one file and grep them against another file and print out only the unique patterns. Unfortunately these files are so large that they have yet to run to completion. Here's the command that I used:

Code: grep -L -f file_one.txt file_two.txt > output.output Here's some example data:

Code:
>FQ4HLCS01BMR4N
>FQ4HLCS01BZNV6
>FQ4HLCS01B40PB
>FQ4HLCS01BT43K
>FQ4HLCS01CB736
>FQ4HLCS01BU3UM
>FQ4HLCS01BBIFQ

how to increase efficiency or use another command?

View 14 Replies View Related

Debian :: Append File Content In Another File When Pattern Matches

Feb 5, 2010

I have a file, say abc.txt, whit some text lines.The I have a second file, say 123.txt where at a certain point one can read "WORD".I would like to append the whole content of abc.txt (as it appears in abc.txt) in the line after "WORD".

View 1 Replies View Related

General :: Searching Content Of The File Using File Browser Nautilus?

May 27, 2011

I'm using rhel6. Using File Browser Nautilus 2.28.4 I could easily locate any file I'm interested in by it name. I'd like to use this File Browser to locate the file name based on it content e.g. based on some word in the text file. It doesn't work for me that way ... My question: does Nautilus support the search of file based on it content or only based on the name of the file itself?

View 4 Replies View Related

Programming :: Sed - Save Output To File With Filename From Content Of Another File?

Feb 28, 2011

My employer issues pdf files with everyones work schedules. I copy the content and save it as plain text in a file called unformatted (hope to be able to automate this step someday). Im working on a SED script that reduces unformatted to only display what I want to see and saves the result in a file Iïve named formatted. After that I have to manually copy formatted and save it with that days date as a filename e.g. 2011-02-25 or whatever day is scheduled in the pdf, for use on a mobile device (Nokia N900). I noticed that the date occurs on certain lines in the file so I added a line like:

sed -n 's/^Date: (201[1-9])/([0-1][0-9])/([0-3][0-9]).*/1-2-3/p' < unformatted >theDate
That creates a file theDate with the date in it that I wish to use as the filename for this particular instance. So I would like to skip the file formatted all together and have the sed- script write to a new file using the content of the Date as a filename, but how do I make that happen? And of course it would be more elegant if I could skip the intermediate theDate file as well.

View 4 Replies View Related

Programming :: Reading File And Compare In Bash Scripts?

Dec 9, 2010

how to program in bash, an i have a problem, i am trying compare values in between 2 values (from another file), so far my solution is to make a nested for loop, but that causes it to compare every value. Here is a visulization of what i want

file.a 2,3,4,5
file.b
3 5

[code]...

i want the values 2, 3, 4, 5 from file.a to be compared inbetween values 3 5, 6 9,1 2, 4 7 from file.b (var1 is the value im comparing, var2 is the less value, var 3 is the greater value)

for i in $var1
do
for k in $var2
do

[code]....

my problem with the above code is it compares EVERYINNG, not the values inbetween what i want (which is 3 5, 6 9 etc).

View 8 Replies View Related

Programming :: Copy One File Content To Multiple File

May 28, 2010

I wanted to copy one file to multiple new files. I have an idea to write a script and do the operation. But here i m looking for any particular command to do this operation.

View 1 Replies View Related

General :: Script To Read And Compare Two Consecutive Lines In A File?

Jan 18, 2011

I have a file like below

ADP_Comment- 4758
ADP_Comment-is missing
cbdkbckd- 46983

[code]...

View 15 Replies View Related

Ubuntu :: Create Two Lists Of File Names Irrespective Of Directories And Compare?

Aug 13, 2010

I have an internal hard drive and an external hard drive, both with about 350 GB of data. The data came from the same source, but over the last couple of years, different people have moved files around to different directories, and some files have been deleted. Now I want to merge all the files onto the internal hard drive. I estimate that 80% of the files on the external hard drive are the same, so I don't want to copy 290+ GB of data over when I already have it.

Therefore, I need a way to find just the files on the external hard drive that don't already exist on the internal one. In other words, I need to create two lists of file names irrespective of directories and compare them, selecting only the file names that exist in one list OR the other. I've Googled for solutions but can't find anything suitable. There are ways to create text files of the file names and compare them with diff, but they have to be in the same order, and since these files are in vastly different directories, that won't work.

View 5 Replies View Related

Software :: What Program To List All Installed Packages In A Text File And Compare 2 Lists

Feb 22, 2011

I need to get names of all installed packages in 2 machines and save them in 2 text files, then I want to compare these 2 files to know the differences between 2 files and from that I could know the differences between 2 machines. Is it possible to do that and what program I could use?

View 2 Replies View Related

General :: Find Will Go Through The Content Of Tarball As Well And List All Content

Oct 5, 2010

I am using find to search for .tgz files modified more than 7 days ago and delete them.find /directory/ -iname backup*.tgz -daystart -mtime +7 -exec rm -rf {} My problem is that find will go through the content of tarball as well and list all content. I want to only search main tarball and delete it if older than 7 days.

View 4 Replies View Related

General :: Change The Content Of File?

Nov 10, 2010

i have a file and i want to change the content of file but i also want that md5sum of that file remains same.

View 14 Replies View Related

Fedora :: Embedded Mp3 File Content Not Playing In FF / Fix It?

Oct 31, 2009

I am trying to play embedded mp3 content in FF. When I click on the link to play the mp3, a new tab opens up and all I get is a grey screen. Does anybody out there have any ideas on this? I have run Autoten and installed all of the necessary codecs.

View 10 Replies View Related

General :: Find File By Content On System?

Sep 21, 2011

How to find file by content on linux by command. Example: i want find file contain word "helo" on my computer (OS: LINUX)

View 4 Replies View Related

Ubuntu :: [Scripting] Remove Content Of One File From Another?

Jun 22, 2011

I've been puzzling over this for a while and have not been able to reach a solution, so turning to your good selves for advice! I currently have two files, let's say they look like this:*File A*

Code:
item1
item3

[code]....

View 6 Replies View Related

General :: Write A Script Which Will Add A Content To A File?

Jun 13, 2010

How would i write a script which will add a following content to a file.File Before running script.

Code:
acpi = 1
apic = 1
builder = 'hvm'[code]....

View 3 Replies View Related

General :: Set Date Time Using A File Content?

Jan 13, 2010

I have a file called foo with a date string in it - and nothing else in the file

2010.01.13-22:28:28

I want to send this file content to date -s command so I can modify using a cron job.

I tried several ways to pipe the file contents to date command but did not work.

View 4 Replies View Related

Programming :: C - Can't Print In Screen The Content Of File

Mar 20, 2010

why this code can't print in the while loop the content of the file ?

Code:

#include <stdio.h>
int main()
{
FILE *fp;

[code]...

View 7 Replies View Related

Programming :: Display Content Of Txt File In Xbmc?

Apr 25, 2011

go about developing this add-on. i am testing this on my xbmc-live set-up; i am fairly affluent in bash/ c but unfortunately i dont have experience with python.i trimmed the data using this bash 1-liner so the output looks like:

Code:
xbmc@XBMCLive:~$ wget -q --output-document=- www.google.com/movies | sed -n 3p | tr '<' "
" | egrep "(title_bar|id=link_1_theater|class=info|mid=|Rated|class=times|fandango)" | grep

[code]...

View 2 Replies View Related

Programming :: Iterate The Content Of A File In The Shell Script?

May 29, 2010

i need to check group of URLs and there https requests from browser. Recently i got some command line web browsers to know the HTTPS status of the URL like curl, wget etc... Now all of i need to do is write a shell script. I will put all my URLs in a text file and my shell script should read each URL one by one and log the status along with the corresponding URL.

Sample output:

./myscript.sh url.txt
1. site - 200 OK

View 6 Replies View Related

General :: Paste File Content Into GEDIT With Xclip?

Dec 18, 2010

I have a file clipboard.txt

I do :

Code:
sleep 10s ; echo "focus on the gedit" ; xclip -o clipboard.txt
is not working.

How to make that possible, how?

View 2 Replies View Related

General :: Filter Find And Du By Content Of Inner File In Subdirectory?

May 30, 2010

I have the following command that I run on cygwin:

find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | xargs du --max-depth=0 > foldersizesreport.csv

I intended to do the following with this command: for each folder under /d/tmp/ that was modified in last 150 days, check its total size including files within it and report it to file foldersizesreport.csv however that is now not good enough for me, as it turns out inside each

/d/tmp/subfolder1/somefile.properties
/d/tmp/subfolder2/somefile.properties
/d/tmp/subfolder3/somefile.properties
/d/tmp/subfolder4/somefile.properties

so as you see inside each subfolderX there is a file named somefile.properties inside it there is a property SOMEPROPKEY=3808612800100 (among other properties) this is the time in millisecond, i need to change the command so that instead of -mtime -150 it will include in the whole calculation only subfolderX that has a file inside them somefile.properties where the SOMEPROPKEY=3808612800100 is the time in millisecond in future, if the value SOMEPROPKEY=23948948 is in past then dont at all include the folderin the foldersizesreport.csv because its not relevant to me.so the result report should be looking like:

/d/tmp/,subfolder1,<itssizein KB>
/d/tmp/,subfolder2,<itssizein KB>

and if subfolder3 had a SOMEPROPKEY=34243234 (time in ms in past) then it would not be in that csv file.so basically I'm looking for:

find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | <only subfolders that have in them property in file SOMEPROPKEY=28374874827 - time in ms in future and not in past | xargs du --max-depth=0 > foldersizesreport.csv

View 1 Replies View Related

General :: Pass File Content Through URL Using Shell Script?

Jul 16, 2011

I am calling a URL from shell script and passing few argumants,Here i have to pass file content as one argument.How can i pass file content through URL.

eg:
content=`cat /Users/test1.txt`
open http://localhost:8080?filecontent=$content

[code],...

View 1 Replies View Related

Server :: Move File System Content Between 2 Disks?

Oct 14, 2010

I have to move all the files and directories between 2 file systems. Is it good practice to move them at once or first copy them and then move ? How to do this to preserve the permissions and directory structure ?

View 3 Replies View Related







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