General :: Writing A Script That Compares Two Different Files?
Jul 26, 2011
how to match to find matches in two different files when comparing timestamps. The fields I'm wanting to match up are in the format:
Jul 26 09:33:02
I have tried reading the file line by line and using awk '{print $1,$2,$3}' which only gets and stores the timestamp in one of the files. I've been looking around and saw this example:
awk 'FNR==NR{!a[$3]++;next }{ b[$3]++ }
END{
for(i in a){
for(k in b){
if (a[i]==1 && i ~ k ) { print i }
}
}
}' $FILE $FILE2
Which sorta works but its way over my head at the moment. The two files can be found in your /var/log/syslog and /var/log/auth.log (using Ubuntu 11.04)
View 9 Replies
ADVERTISEMENT
Jun 30, 2011
Is there application for linux which would run everyday, and if that app suspect changed files, warn me via email with list of changed files?
View 3 Replies
View Related
Dec 5, 2010
How to compare CPUs? Is there a trusted source that compares cpu performance?
View 4 Replies
View Related
Jan 25, 2010
For some time now, I'm having some problems with configuring an NFSv4 server to let it work with a firewall. I've already searched to web, but I was unable to find a solution that works for me.
The situation is as follows:
I'm trying to connect an NFS client to an NFS server that is behind a firewall. I don't have access to this firewall, but I can contact the administrator to open some ports for me. I already did this for opening port 2049.
The result is that the client can read files from the server, but is unable to write files to the server. I believe that for writing an extra RPC-connection needs to be set up. However, the ports on which the RPC-connection is set up, seem to be different for every connection (I verified this using 'netstat -tn').
Clearly, this is a problem since the server is protected by the firewall.
Thus, what I want to do is configure the server in such a way, that it always uses the same server-side port(s) to connect with the writing clients (just like 2049 for reading). I've already tried to configure the /etc/default/nfs-kernel-server and /etc/default/nfs-common files, but that hasn't really worked out yet.
Note: Because I don't like to contact the system admin every day, I hooked up 2 computers (client/server) on which I set up the same configuration (without the firewall). I'd like to see it working on those machines first (that is, 'netstat -tn' showing the correct port), before I contact the admin to open some extra ports.
View 2 Replies
View Related
Jan 1, 2010
How do you send files, save or other wise write to CD using Mandriva Linux? On windows you get a helper menu. Linux does not offer this option in it's helper file and you can't click and drag a file in the CD folder. The dialog box reads "you do not have permission to write to this folder" when I try to drag it in and I can't change the permission signed in as Root.I don't have a clue. I wish Linux Questions would add a emotioncon that has the expression " what the hell buddy? are you on ten hits of acid?
View 8 Replies
View Related
Feb 28, 2010
I am trying to write .pgm images using the O_DIRECT flag in open().I have a char* buffer which has the image data. I know that I have to align the buffers and have done that using posix_memalign() yet only a part of the image gets written.Has someone used O_DIRECT for writing files successfully?
View 1 Replies
View Related
Feb 6, 2011
I want to perform an action with a shell script and then log the event in a file in /var/log. However, I keep getting permission denied error messages.
View 5 Replies
View Related
Jan 1, 2011
Reading and writing text files in C?
View 9 Replies
View Related
Feb 22, 2010
I have tried to configure an Enemy Territory Server in an way that a common user could run it just executing a command line. The first thing I did was writing a script like that
/usr/local/games/enemy-territory/etded +set dedicated 1 +set net_port 27960 +set fs_game etpub +set fs_homepath /usr/local/games/enemy-territory/27960 +set sv_punkbuster 1 +set +exec server.cfg +set +exec punkbuster.cfg +set +exec bots.cfg
and then putting it in the /usr/local/bin directory. Ok, the things seem to be fine, but then I realized that the program tries to write some config and log files. I noticed that because some warnings appear in the command line, like that Couldn't write etconfig.cfg always that I run the command as a normal user. On the other hand, if I give writing permission to these files, all the warnings disapear.
But I don't think it is a good way, because someone could change these files by hand, what would not be good.
My last try was to set the suid of the script up, with the command chmod u+s /usr/local/bin/etded-server
But as I already knew that suid does not work well with shell script I wrote a C source like that:
[Code]...
View 4 Replies
View Related
May 10, 2010
Currently when I create a folder, it comes down as 755 permissions.
I want it to come down as 775 permissions by default.
How can I change this?
View 2 Replies
View Related
Jun 22, 2010
I am working on a little project in python. i have produced this prototype
Code:
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
#DocC documentation prototype
[Code].....
View 2 Replies
View Related
Mar 18, 2010
Samba seems to crash and come back after some seconds if I copy a lot of small files in a short period of time over the network. How do I fix it?
I have Ubuntu 9.10 Server 64bit running on a D945GCLF2 board sharing two 1TB ext4 formatted HDDs to my Windows PCs using samba. I've been having an issue with reading or writing files through samba. It happens during copying operations or checksumming, anything that reads or writes MANY small files in a small amount of time. I am pretty sure the problem has to do with my server because the server has run on two different LANs in different homes and will crash from activity with any of several other PCs. There is no crashing if I access the files through SSH, although when I do that the max transfer speed is less than 1MB/s.
When I induce the crashing, there is absolutely no output to the server terminal.
As an easy access example of something that will crash samba, extracting Cinebench R11.5 to the server will do the job. It always fails.
View 9 Replies
View Related
Sep 27, 2010
Whenever I am busy reading or writing large files, or large sum of files, my computer is unresponsive. Screens are getting greyed-out and I just can sit there and wait until the reading/writing is done.
This is not caused by the CPU which is overstressed because it is not. Look at the attachments and you will see the CPU is used for about 20%. When these pictures were captured the computer was using hellanzb to unrar a long list of rar-files.
When you look at my signature you see the computer is not bad at all, just disk-access is slow. I can transfer files with a maximum speed of 30MB/s. Is that normal or is it very slow? I don't know the numbers. I have 2 SATA disks.
O.S. is Mint 9-Isadora, based on Ubuntu 10.04 and I use the 64-bits version.
View 9 Replies
View Related
Dec 2, 2008
I synthesized a seismogram by using Fortran codes, I need plot the synthesized seismogram and the data together, so I can verify the accuracy of code. Now I encounter a question: how to read the SAC data by Fortran code, I have searched some codes on Internet, the details as follow:the velr12a.sac is my data file.
Code:
c read sac file
PROGRAM RSAC
PARAMETER (MAX=1000)
DIMENSION YARRAY(MAX)
CHARACTER*10 KNAME
[Code]....
View 2 Replies
View Related
Mar 25, 2010
My VPN is behaving funny sometimes, and I have to restart it often.I wanted to write a script which does that for me.It doesn't have to be anything fancy, just a shortcut for the commands I have to type into the terminal. More specifically: it will look at the running processes.If it finds a running vpnc process, it will kill it. Then it will start vpnc.I've written bash scripts of similar complexity,but now I don't have a bash,only an ash. Until now, the only difference I noticed is that there are much less commands available, but then, I don't use it very often.So I have some questions.
Is writing ash scripts different than writing bash scripts?
Is there something specific to consider when doing it?
When the script is ready, how can I deploy it? For bash, I just put the executable file under /usr/lib and run it by typing the file name into the command line, will this work with ash?
Are there any special pitfalls to watch out for in the script I want to write? I think that the killing process part may get hairy, if I write something that kills the wrong process, but even then running the script shouldn't break anything permanently, right?
View 2 Replies
View Related
Mar 3, 2011
i am having a the following line in a file
<property name="connection.password"></property>
i have to give password in this line, like this
<property name="connection.password">XXXXXX</property>
Is this possible to acheive this using sed command
Beause i have to do this for n number files. so if i have option in sed for this the i will be doing this using script.
View 7 Replies
View Related
Jan 25, 2011
user@user-laptop:~$ sudo dd if=sd_backup of=/dev/sdd bs=4M conv=noerror,sync
205520896 bytes (206 MB) copied, 28.564 s, 7.2 MB/s
247463936 bytes (247 MB) copied, 57.1285 s, 4.3 MB/s
260046848 bytes (260 MB) copied, 73.2388 s, 3.6 MB/s
289406976 bytes (289 MB) copied, 104.121 s, 2.8 MB/s
[Code]....
How come dd gets slower after copying this 8GB file? What can I do about it?
View 1 Replies
View Related
May 6, 2011
When you are performing time consuming operations in bash like installing new software, is it possible to write text that will appear at the prompt when the operation has finished.
E.g
Imagine running:
apt-get install eclipse-platform
Then it will use quite a while to finish while you see the installation log, meanwhile I want to create new folders (workspaces) which Eclipse later will use.
Is this possible without opening a new terminal (or tab)?
View 5 Replies
View Related
Sep 17, 2011
When I login I always do:
ssh myuser@111.111.111.111
Is it possible to do something like:
ssh myuser@server1
I would like to use a name, not an IP address, is it possible?
View 2 Replies
View Related
Sep 7, 2010
Basically I have a USB flash drive currently formatted under vfat. I can log in as root and the system automatically picks it up and automounts the drive successfully. What needs to happen is that a non-root user needs to be able write to this device while root has mounted this device. Due to other program constraints, I can not mount the device using another user so I have to do it with root.
View 9 Replies
View Related
Nov 10, 2010
My video card writes the CRT in one of two "modes". High intensity ("bright chars") and low intensity ("dim chars"). How do I set vim in order for him to use only low intensity?
View 2 Replies
View Related
Sep 29, 2010
When i Write commands in terminal it does nothing
View 1 Replies
View Related
May 3, 2010
How can we write arrayValues in file? Lets say arrayName=(1 2 3 4 5) Now if i want to write these arrayValues into file
In first line in file :1
In second line in file :2
In third line in file :3
In fourth line in file :4
In fifth line in file :5
View 3 Replies
View Related
Mar 18, 2010
I need to write an else-if condition in a makefile, and though the format is posted on several websites, nothing seem to be working, andI get an error everytime. Could anybody please write a small example with an else-if conditional in a maekefile?
View 1 Replies
View Related
Mar 18, 2010
I am using Grass GIS
I have written a script which outputs a list of numbers to a file
code snippet:
r.stats -1 fs=, input=Bones_AVE > /home/gary/AVE_monte_carlo/rstats_AVE$i.csv
so this makes acsv file with one column. I want to run it again but rather than outputing to a new csv i want to add it to this one as the next column. For this example there will be 100 rows per column.
the 1st one will make the file
[grassGIS code]> /home/gary/AVE_monte_carlo/rstats_AVE.csv
add ',' after each value
the next one
[grassGIS code] open file /home/gary/AVE_monte_carlo/rstats_AVE.csv
[Code]....
View 1 Replies
View Related
Jul 28, 2010
I am trying to write input to a shell and get the shell to parse the input that I am writing to it as if a user was typing in commands.
Thus far I have tried echoing some text into the shell's FD for STDIN in /proc/<pid>/fd Whilst this displays the text that I echo, the shell that I am writing to never tries to execute the command that I pass to STDIN. What is the difference between a shell taking STDIN from the user and data written to STDIN by another process e.g. echo ? It appears I am missing something fundamental.
View 5 Replies
View Related
Nov 18, 2010
I'm writing a script that among other things partitions and formats disks using SW RAID and LVM. I've read somewhere that for older versions of Linux it was a good idea to use the dd command to zero the first couple of blocks od a device before partitioning it (or formatting it?) Is this practice still recommended? To what end?
View 1 Replies
View Related
Jul 14, 2010
I've seen the trackpad tool to write chinese characters on macs, is there any such linux clone? Or are there any projects that anyone knows of which are trying to create that for linux?
View 1 Replies
View Related
Apr 11, 2011
Is it possible to write ksh script in the spec file? The target is after I perform
rpm -i my_rpm.rpm
According to the spec file, ksh script will do some installation & configuration. For example run other script and edit some files.
View 1 Replies
View Related
Mar 3, 2009
I have custom software that writes to a sensitive large file when the user does something. I would like to make backup copies of The file that gets written to, but if I make a gzip of the file at the same time someone is changing something, it will corrupt the backup because some of the data will be missing, as its backed up during being written to.
a) Is there a way to detect if a file is currently being accessed/written to?
That way if its currently being accessed, I can just make the script wait until its done and then finally back it up.
b) Instead of backing up the large file while it has potential to get written to, would it be better to make a copy of the file first, then gzip the copy? This idea comes from the fact that gzipping the original takes 5-10 seconds, whereas making a copy only takes 1-2 seconds. The less time, the less chance of corruption.
c) Is there anyway to freeze a program or a file to stop it from being written to for an amount of time?
With a, b, and c together. The best solution I have to my problem would be a script that first detects rather the file is being accessed. If not, it would then freeze the file/program and then make a quick copy of it. Once the copy is created, it will unfreeze the original file/program and then go about gzipping the copy.
View 3 Replies
View Related