Programming :: Check If File Contents In Another File?

Nov 4, 2009

i am trying to write a bash script. i have a text file called comp2.tmp which has a list of items in it

example comp2.tmp

Code:

filename.pdf
filename2.zip
filename3.ttf
and so on

I have another text file called comp1.tmp which should have the same list of files in it, but does not look as pretty

example comp1.tmp

Code:
someothertext here ...... 10/30/2009 ...... filename.pdf
=========================------------------==============
othertextagain .......... 09/28/2008 ...... filename2.zip
========================------------------===============
bunchmoretext ........... 04/12/2005 ....... filename3.ttf
and so on

i would like to check if the filenames listed in comp2.tmp exists in comp1.tmp

View 3 Replies


ADVERTISEMENT

Software :: Check The Contents Of A Text File For A Specific String And Remove It From The File From The Command Prompt?

Oct 14, 2010

I want to be able to check the contents of a text file for a specific string and remove it from the file from the command prompt. I would basically be searching through a number of files and if a specific string is found I would like it removed automatically. pretty much a find and replace, were the replace is nothing. any one got any ideas on how you would do this. I already have the search part sorted just need to be able to remove the string I don't want from the multiple files.

View 4 Replies View Related

Programming :: Append Contents Of One File To Another Existing File?

Nov 17, 2008

I have two files list1.cfg and list2.cfg both files contains differentrecords details like

List1.cfg
NAME1:25:C:NAME LINE1:
NAME2:25:C:NAME LINE2:
CITY:25:C:City:

[code]....

Now I want to append contents list2.cfg to list1.cfg(It ispposible using cat list2.cfg >>list1.cfg) but I want to check if content of (record) in list2.cfg is present in list1.cfg then dont append it otherwise append it.

View 1 Replies View Related

Debian :: File Permissions To See Other Folders And Check The Contents

Jul 17, 2010

I've created a new group and a new user called dftp... Now I wanna do one thing... If 'dftp' connects thru ftp he should be directed to a particular location... and he shouldn't be able to see other folder except for his own including the parent folder that contains that location... I changed dftp's home folder to the location I want. However while connecting thru ftp. user dftp has been given permissions to see other folders and check out the contents of the other folders.

View 5 Replies View Related

Programming :: Locate A File By It's Contents?

Jul 16, 2011

A long time ago I wrote a short essay about the 'federal' 'reserve' board. I don't remember it's name or format. I think it's somewhere on my rather large hard discs (to of them divided into various partitions).I'm trying to write a command line that will find it based on a quote that is in it: "our fathers brought forth"I have tried various configurations of grep, and or combining grep with find, but I'm getting nowhere. I really don't understand the syntax of either command, or how they work together, and the examples that I can find are really no help at all.

View 6 Replies View Related

Programming :: Read The Contents Of A File?

Jan 11, 2010

I am trying to read the contents of a file into something else. I have a file.txt that I am working with, I want to read the file and take the data and run some commands with the data that it read. So if it read www.yahoo.com I want to be able to nslookup. Does that make sense? I have been trying to use the read command but that does not seem to work. I even was trying to read filename | > filename to see if I could even read any of the data at all. Nothing is working.

View 8 Replies View Related

Programming :: Watching File Contents Continously?

May 27, 2010

want to watch the file continoulsy for any newly written data to file.Presently i am periodically opening the file and checking for the newly updated contents.Is there something like refresing the file descriptor, since open is a system call, calling it many times may affect performance. Does the tail program opens file multiple times to check for the updated contents when used with -f option.Can some one explain or give some links on how the filedescriptors remembers its end contents while some other programs keeps updating the file.

View 5 Replies View Related

Programming :: BASH: Listing Contents Of .zip File Into An Array?

May 18, 2010

I want to list the contents of a zip file amd put each entry into an array. I've been doing

[code]....

View 4 Replies View Related

Programming :: Read Text File (Distribute Its Contents)

Jan 22, 2011

How can read the file /var/etc/allInOne.cfg and distribute its contents on multiple cfg files using C language. /var/etc/allInOne.cfg contain the data and the path of each text file.

The source file "/var/etc/allInOne.cfg "look like this:
line1
line2
...
line10
filePath:/var/etc/file1.cfg
line12
line13
...
line14
filePath:/var/etc/file2.cfg
linen
..
filePath:/var/etc/filen.cfg
the result will be :

The expected result is:
/var/etc/file1.cfg will contain line1 to line10
/var/etc/file2.cfg will contain line 12 to line13
/var/etc/filen.cfg will contain linen to linen-1

View 13 Replies View Related

Programming :: Insert A Comment In Html File Based On Its Contents?

Jun 10, 2010

I have multiple HTML files in a folder. there is a <h2> tag like this:

Code:

<h2>some text</h2>

in each file. I want to write a shell script/batch file to add this tag in <head> section of each file:

Code:

<!-- TITLE= "same text from h2 tag" -->

Note that <h2>some text</h2> in some files has 1 or more linebreaks and so I couldn't capture tag content using a simple grep or...
for example:

<h2>first part of text
second line of text</h2>

The line break shouldn't be shown in <!-- TITLE= "same text from h2 tag" -->. The script has to capture tag content & skip line breaks.

View 3 Replies View Related

Software :: Overwrite The Contents Of A File Without Changing The File Size?

Jul 12, 2010

We have some large files with sampling data in it. Don't want to delete these files. But want to quickly overwrite the file with 0s and/or 1s and preserve the original file size.

View 3 Replies View Related

Programming :: Check If Log File Is A Certain Size?

Mar 25, 2010

script that will check if my log file is a certain size? EX: I want to limit the size of my rsync log to say 5MB, if that's true I would move it and create a new one.

View 4 Replies View Related

General :: Replacing A String In A File With The Contents Of Another File?

Jun 15, 2010

I would like to know how I can replace a string in one file with the complete contents of another life.

View 10 Replies View Related

Programming :: Check If There Is Any Ejb File Exists In The Directory

May 1, 2011

I have a directory called /data In this directory I have some files like abcejb.jar,12_ab_ejb.jar, shejb.jar, test I need a shell script like... 1st I want to check if there is any ejb file exists in the directory using some condition If ejb files exists I want to redirect the ejb files list to a file called list. Now I want to copy all the files in the list file to some remote system.

View 1 Replies View Related

Programming :: Check .xml File And Which Character Is Malformed In 'utf-8'?

Jun 15, 2011

I need some software that will check .xml file and tell me which character is malformed in 'utf-8'. I am using perl for some parsing.

View 2 Replies View Related

General :: Grep The Contents Of A File With Another File?

Sep 25, 2010

someone once told me that use can pass a file to grep and use that to search the contents of another file. if that is the case I'm not entirely sure why the following isn't working for me.

Code:

[root@LCENT01:~]#grep -i id_rsa.pub .ssh/authorized_keys
[root@LCENT01:~]#cat id_rsa.pub >> .ssh/authorized_keys
[root@LCENT01:~]#grep -i id_rsa.pub .ssh/authorized_keys

View 3 Replies View Related

Programming :: Bash - Statement To Check If A File Exists Or Not?

Oct 6, 2010

This script that I found online does the job it promises. it does convert the files to mp3 without an issue. What I need to include now is an if statement that says If $file.mp3 exists then delete $file.wav

Code:
#!/bin/sh
# name of this script: wav2mp3.sh
# wav to mp3
# Credit to the script creator (Nikesh Jauhari):

[Code]...

After that I'm stumped as to how to do the if statement

View 14 Replies View Related

Programming :: Shell Script / How To Check File Size?

Jan 21, 2009

I have a file that's supposed to be growing in size 24/7. I want to check every 10 minutes via cron that it's actually growing. If not, send an email. Does anyone know how to write a script to do that?

View 3 Replies View Related

Programming :: Check That The Same File Exists Within Two Different Directories Using A Filename As A Variable?

Apr 30, 2010

I am in need of a way to check that the same file exists within two different directories using a filename as a variable. Here is the process which requires it: The script is reaches out (via ftp) and pulls down a file(s) and delete it afterwards. This is halfhazard because in the instance it doesnt pull down the file, yet still deletes it, we are up a creek. I am looking to pull it down to a temp location and then verify that file exists in the location in which it needs to be present to process before deleting it, adding a little extra layer for security. The script itself is finished.If I put a file name in manually it works perfect. I just need a way to pump the filename into the variable.

View 1 Replies View Related

Programming :: Write A Shell Script Which Will Check A File Name In A Dir And Copy It?

Apr 2, 2010

I am a novice to the shell script. In my system from db server the log files are enerating with the name log1.txt,log2.txt..... It is capable of keeping 10 files at a time in dir called /db/sis/log1.txt. I want to copy the log1.txt to another directory when ever it generating by attaching the time stamp to it for the back-up purpose. this files will be there for a period of 24 hours. after that the back-up dir should be cleared and it start copying again the fresh file from the same dir.

View 3 Replies View Related

Debian Programming :: Check If Files Exists By Read Input From A File

Jul 27, 2013

I need a script that dose the following checks if files exists by read input from a file then compares them to the files listed in the directory if they don’t exists the script would report back which file dose not exists. I also need to format the output so that files are grouped in different groups, group A, B, and C and etc based on file name. I would like the output of that do not exists files to be sorted based on second number in the file name than group according. I understand some of the basics of bash scripting something along of the lines of a loop and if statements might do the trick. Below is what I have so far. I don’t car so much about the script reporting back the file exists I prefer to only know if the file is missing and is less than 3 days old. Problem is if a file dose not exists in the reports file the test compares against the wrong file.

Group A

Foo22000.tar.gz
Foo22010.tar.gz

Group B

foo25000.tar.gz
foo25100.tar.gz

Group C

foo26000.tar.gz

Code] ....

View 2 Replies View Related

General :: File Privileges - Check And Set Who Can View Or Open A Given Folder Or File?

Jul 30, 2010

How can I check and set who can view or open a given folder or file?

View 1 Replies View Related

General :: Moved File Partitions - File System Check Failed On Fedora, Windows Will Not Boot

Dec 16, 2009

my partitioning layout was as follows

Vista Recovery
Windows 7
GRUB
Extended
-->Fedora 12 (ext4)

so, I shrunk my recovery in Windows 7 successfully, and booted into my Fedora 12 live cd to run Gparted, and move the partitions so that the free space could go towards fedora, I did such, and then I couldn't expand the partition to my dismay. Next, I woke up this morning, tried to boot to fedora to run SSH, grub loaded, but when I tried to boot fedora, I got the "File system check failed" error, and when I tried 7, it just went to a blank screen with a single "_" in the top left-hand corner.

View 7 Replies View Related

Ubuntu :: Check For That) Then Add The Name Of That File To A Text File?

May 5, 2010

i am writing a script for my ubuntu server and basically i want it to download a file that i specifically type in then take that file put it in a certain folder (note file may or may not be archived so i'd have to check for that) then add the name of that file to a text file.i know sounds strange but this is what i got so far:

Code:
#!/bin/bash
echo "-----Star of Script-----"
echo "Please enter URL:"
read URL
cd testdir
wget $URL
//extraction here + delete original archive (rar,zip,anything :S)
echo name_of_file >> list.txt
echo "-----End of Script-----"

View 6 Replies View Related

Fedora :: Unable To Check "allow Executing File As Program" In File Properties - Permission Denied

Feb 27, 2011

Im trying to run a program but my system won't let me.i used to be able to run executable files without a problem but i can't anymore when i double click the file i get "there is no application installed for executable files" i am unable to check "allow executing file as program" in file properties there is a script file which runs the program but all i get from the terminal is "permission denied"

View 14 Replies View Related

Programming :: Check If The Content Of A File Is "1"?

Feb 7, 2010

i want to close the program if the content of the file /tmp/file_name is 1 (just the number 1).

dont need to check all the time, just when start the program.

something like this:

Code:
"read the /tmp/file_name"
"check if the content of the file_name is 1"
"if not, do something"

what i need is very simple to do in shell script:

Code:
go=`cat /tmp/file_test` # "cat /tmp/file_test" read the content of the file_test
if [ "$go" -eq "1" ]; then # if the content of the file_test is 1
echo "ok, ready to exit now"; # now i can put the exit command
fi

but i dont know how to do the same thing in C...

View 11 Replies View Related

General :: Ubuntu - Can't See Contents Of File

Jul 29, 2010

In Ubuntu 10.04, there is a certain file that appears highlighted in terminal. When I try to cat the file, it says there is no such file or directory. How can I see what's in this file? Is this a symbolic link?

View 1 Replies View Related

Ubuntu :: Print Out The Contents Of A File?

Feb 24, 2010

how do I print out the contents of a file?

View 4 Replies View Related

Ubuntu :: How To Delete The Contents Of This File.

Mar 23, 2010

/root/.local/share/Trash/files/I have a tar backup file in there and can't get rid of it. I've tried from root with Nautilus, the files disappear for a couple of seconds and then reappear.

View 7 Replies View Related

Ubuntu :: Way To View The Contents Of A .dsk File?

Apr 30, 2010

EDIT:SOlved, I'm trying to figure out how to delete this

View 1 Replies View Related







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