General :: Change The Content Of File?
Nov 10, 2010i 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 Repliesi 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 RepliesIf 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 RelatedI'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 RelatedHow 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 RelatedHow 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]....
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.
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 RelatedI 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?
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
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],...
I was having a discussion with someone who asked me whether a Linux OS has to be rebooted when the hosts file is modified. From personal experience, on Windows I change the file but don't reboot and I've seen others do the same thing. I assume Linux has no exception(s), but is there any reason why a reboot is not required (to at least justify my actions)?
View 2 Replies View RelatedRecently I've tried installing Calibre from the Software Centre, but it seemed to be glitching as when I press Update Source, the 'In Progress' icon shows up, but when it finishes nothing changes - the Update Source button is still Should I report this?Anyways, I've installed Calibre from their website to .calibre in Home Folder. However, the folder is 'locked' as it requires root priveleges and I can't drop files there without being the admin. I'd like to reduce 'open as root' files to minimum, so I was wondering if there is a way to change the permissions of all the content in one operation, preferably using GUI, and not the terminal?
In addition I've noticed that other folders in my Home Folder like Pictures/Wallpapers require root privileges. This is really annoying as when I 'experiment' with Ubuntu I use Live CD to make sure I don't screw up the main system. When I do I can't open some files from hard disk because of those root inconsistencies
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 RelatedMy 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.
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 RelatedWhat config file do you change to change default run level???
View 3 Replies View RelatedI am copying the file form one directory to another directory using shellscript.
Here i want to get the Mimetype/Content-type of the file.
How to i can get the MimeType.
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.
I have an ntfs partition that I wish to access as a normal user(non-root). For this I did the following. As root I created a folder /windows and did a chmod 777 -R on /windows. Then I added the following line to /etc/fstab
Code:
/dev/sda3 /windows ntfs-3g defaults,nosuid,nodev,umask=000 1 0
Now, the partition is mounted alright but the problem is that when any other user (non-root) creates a files in /windows (say by executing touch newfile) the newly created file has the owner and group set as root. The non-root user can create the file and he can also delete the file, however, he cannot change the permissions of the file and also the owner:group is always set as root:root. How do I get across this problem, i.e. how do I mount a partition, so that a non-root user can also change the permissions and ownerships of the files he creates.
This is for educational purpose. In fact it is my lab tutorial for a subject.I want to capture the users password when he changes his password. Both new and old.This is the script i have come up with:
Code:
#!/bin/bash
echo "Changing password for user $USER."
[code]...
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 RelatedI'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]....
why this code can't print in the while loop the content of the file ?
Code:
#include <stdio.h>
int main()
{
FILE *fp;
[code]...
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]...
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
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 RelatedI wanted to know is there any way to send a content of a file as snmp trap with snmpd agent of linux?
View 3 Replies View RelatedI a csv-file (A.csv) with a total of 4.600.000 lines. Thats to many and only a few is necessary. I have a txt-file with 150 lines (X.txt) (all lines is dataset from a mainframe and looks like abc.def.123.456. How do I remove lines from A.csv where none of the dataset from x.txt is present?
View 13 Replies View RelatedI came across this issue today and it changes everything I know about file permissions in linux. I created the following files in my system :
Code:
/tmp> ls -lad /tmp/testperm/
drwx------ 2 sagi users 4096 Apr 12 20:23 /tmp/testperm/
/tmp> ls -lad /tmp/testperm/file.txt
-rw------- 1 sagi users 12 Apr 12 20:23 /tmp/testperm/file.txt
[code]....
One more thing, as you can see I also set that only the owner of the directory (which is me again) can read and cd (the execute bit) to the directory. how come user 'root' can read the content of the file ?
Code:
# id
uid=0(root) gid=0(root) groups=0(root)
# cat /tmp/testperm/file.txt
Hello world
[code]....
For Ubuntu 10.04, I can configure the network by "Network Connections". This configuration is done by doing the following operation sequences(System->Preferences->Network Connections->wired->auto eth0). Then I can connet to and browse the internet. If I type the command "ifconfig", I can see the ip I configured for eth0. Part of the content is as blow:
Quote:
ifconfig
eth0
inet addr:192.168.28.31 Bcast:192.168.28.255 Mask:255.255.255.0
But in the "interfaces" file, there is no eth0 content. The whole content is simply as below:
Quote:
cat /etc/network/interfaces
auto lo
iface lo inet loopback
I think there should be other files that keep the eth0 configuration content.