Ubuntu :: Sed Command Empty The File?
Mar 13, 2010
I have this file: 1.txt, with this contents:
Code:
test
mycomputer
I just try change the string "mycomp*" by "othercomputer":
Code:
sed 's/mycomp.*$/othercomputer/' 1.txt > 1.txt
but sed command empty the file.
[Code].....
View 2 Replies
ADVERTISEMENT
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
Feb 19, 2010
I am writing a short script to do some backups.Here is a small section of it:
Code:
echo -n "Please enter your choice ..."
read CHOICE
[code]....
View 3 Replies
View Related
Oct 15, 2010
Simple question but even google does not come up with an answer, seems to be too easy that someone else asked it ;). Could anyone tell me what is the shell command to empty the garbage bin under Linux?
View 3 Replies
View Related
Aug 28, 2010
I mount /home on a logical partition. Files and directories that I trash from here go nicely into the recycle bin, and I can right click on it and choose "Empty Trash" with no problem. Files off of the root directory in directories that I "own" (i.e. /mydir/*) do not play as nicely. I went ahead and followed instructions from another post, namely:
Code:
sudo mkdir /.Trash
sudo chmod 1777 /.Trash
And after trashing some files from /mydir, there is indeed a subdirectory with my uid (1000) and files that I trash from /mydir are going in there. However, the recycle bin on my desktop remains empty, and the only method I have for deleting said files is by deleting them from the /.Trash/1000 folders through the command line. So my question is: Is there anyway that I can trash files from /mydir, see them appear on the desktop recycle bin, and empty the trash without the need to rm them directly through the command line? Not sure if it will help, but here is my fstab:
Code:
# / was on /dev/sda1 during installation
UUID=4129f389-92be-459e-8bbc-928c1440f718 / ext4 errors=remount-ro 0 1
# /home was on /dev/sda6 during installation
UUID=6a30914d-04a3-4b03-85bd-2bf16a68a41a /home ext4 defaults 0 2
# swap was on /dev/sda5 during installation
UUID=f388cf04-bbd6-4bf9-9d69-0778b0f158fd none swap sw 0 0
View 7 Replies
View Related
Sep 28, 2010
I am looking for a way to delete the currently entered commandline without wasting seconds on the "Backspace"-key.
For example I scrolled the bash history and have a long commandline that would execute when I pressed ENTER:
~$ aptitude search openssl | grep dev
But now I decide that I do not want to execute this command. Can I get an empty prompt fast without deleting the whole line with Backspace? On the Windows "cmd" you can just press ESCAPE and it is gone. This behavior would be what I want.
The question may seem trivial but this is bothering me for a long time now.
View 2 Replies
View Related
Mar 23, 2010
I've noticed that when I run:
davek@linux-kw2x:~> df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 20641788 8427780 11165368 44% /
udev 961204 192 961012 1% /dev
/dev/sda3 217642344 4037944 202548468 2% /home
davek@linux-kw2x:~>
I have 44% used. It should be much smaller, under 10%. How do I empty the /tmp file or other file to free up space?
View 9 Replies
View Related
Mar 1, 2011
I logged into my Red Hat Enterprise Linux machine at work (use it for software development) and the primary GUI does not load. Instead, widgets appeared for xclock, xterm, and Firefox. In the terminal, I start typing in commands to try to figure out what's going on, but all commands are not found except pwd and echo. I 'echo $PATH' and that returns just an empty, blank line. 'echo $SHELL' lets me know I'm using cash.
The likely cause was my attempt to install Adobe Reader Firefox plugin yesterday. After it downloaded, I ran the binary but Firefox didn't seem to recognize that I had installed it, so I went into my .cshrc file and added the adobe folder to the path. That didn't seem to work, so I gave up, deleted the binary and the folder I installed to, and removed that directory from the path in the .cshrc file. This last thing (the export PATH line in that file) I'm certain is back exactly as it was before.
I have successfully added the /bin and /usr/bin back to the path from command line via
setenv PATH /usr/bin:/bin
but of course it doesn't stick after reboot nor does it magically load the primary GUI. I'd rather not go through the effort of creating a ticket for our company's Global Service Desk cuz there's no telling how long that could take to resolve. In the meantime, I can't do any programming.
View 23 Replies
View Related
Apr 26, 2011
Using Fedora 14 with Gnome 2.3 Desktop utilizing Compiz and Emerald theme manager. When I empty the trash, the icon is still the FULL Trash icon. I tried using different Emerald Themes, and different Icon sets, but still the Trash Icon stays full. I checked the trash folder in $HOME/.local/share/trash and found nothing, no hidden files.
View 3 Replies
View Related
Mar 15, 2010
I was checking my syslog.conf file recently and it seems that it is an empty file >_> it shouldn't be correct?
View 2 Replies
View Related
Jul 15, 2010
I have a large file that a process writes to. I would like to empty that file. If I delete it the process will stop writing to it. Just flush the content but keep the file.
View 9 Replies
View Related
Mar 2, 2011
I was copying an .avi file to an external hard drive and half way through the copy the drive reset and required remounting. Consequently I have an empty .avi file on the hard drive. I tried to recopy the file and overwrite, but I keep getting 'Could not write to media/harddrive/filename.avi'. I tried to rename to file to be copied but got the same response, I cannot delete the empty file either, as I get an error telling I cannot delete it. I have tried to do this as the user and root with the same result.Any other file I tried to copy onto the external hard drive is fine, just this one zero length file and the file I was trying to copy, the original of the file. I also tried to delete the file on another computer but couldn'tExternal hard drive is a WD elements ntfs, which works great except for this glitch.
View 3 Replies
View Related
Jun 17, 2010
I am using embedded Linux. File open is successful. The file has all the permissions. It is present in current directory too. The size is about 27KB. But s.st_size says it is zero.
inputFileName = "abc.mp3";
FILE* inFile = NULL;
inFile = fopen(inputFileName, "r+b");
[code]...
View 2 Replies
View Related
Feb 28, 2010
Does anybody know why isn�t anything on the /var/log/boot.log file. After the boot I saw some services that fail to load and looking for more detail data on the boot.log file I couldn�t found anything this file is empty. This is My syslog.conf file:
Code:
kern.* /dev/console
*.info;mail.none;authpriv.none;cron.none /var/log/messages
[code]...
View 3 Replies
View Related
Jun 16, 2011
Greetings, I have installed a VMware host on Windows 7 64bit and followed with a 10.04LTS 64 bit guest install. Everything went smooth. I have used VMware before, but the other way around.. Linux host and Windows guest.
So this time I am installing the VMWare tools on the guest, ubuntu 10.04, but it seems to be failing. The vmware tools install ran fine the first time with no errors, but I was getting the follwoing error after logging into the Ubuntu guest afterwards.
Could Not Apply the Start Configuration for Monitors
Error Line 1: Char 1 Whitespace or empty file
So I re installed the VMware tools once again, but still the same.
I am hoping that someone here has come across this before and hs a workaround. I don't think the vmware tools was installed correctly.
View 1 Replies
View Related
Jul 13, 2011
I am not sure why this does not work..
tshark |grep 'string'
Gives me what I want but
tshark |grep 'string' >/tmp/outputfile
Gives me an empty file.
View 3 Replies
View Related
Dec 2, 2010
I have setup a local repository containing several .rpm files. I created a comps.xml file outlining the category and groups for the local repository. However, when I issue the yum grouplist command, I get the following error:
Failed to add groups file for repository: localRepo - comps file is empty/damaged
However, if I try to install one of the the packages in the repository, it works just fine.
Here are the steps I took to create the repodata:
The comps.xml and repository are stored in the directory:
/var/www/html/myrepo/x86_64
cd /var/www/html/myrepo/x86_64
createrepo -g comps.xml .
[Code]....
View 1 Replies
View Related
Nov 23, 2010
I having been searching for a way to create an empty or blank iso file, so that I can mount it, and have a backup application think it's a blank CD. I am tired of wasting CD's by having the application write a recovery CD, just for me to turn around and export it to an iso image to be stored in a online archive, and then throw away the physical CD.
View 5 Replies
View Related
Aug 16, 2010
I'm trying to write shell script to use etc/init.d In fact, my application has written by java and I have made the fat.jar (etest.jar)file as executable one and after I wrote the small script to run it background (etestruner.sh) that is,
Code:
#!/bin/sh
java -jar /root/les/run/etest.jar >/opt/etstout.out 2>&1 &
And after I wrote the service script That is ,
Code:
#!/bin/sh
#
# Startup script for epict
#
# chkconfig: 2345 25 88
[code]....
I tried with google to solve this issue but did not get any result.
View 3 Replies
View Related
Mar 26, 2011
Using awk I pull the first field of a random line from my datafile.myvar1=`awk -F" " 'NR=='$randline' {printf "%s", $1}' myfileThis works fine. The problem is there will be empty lines at the end of the file. Rather than using awkto filter out blank lines I would like to figure this out first.So I test $myvar1 for a blank string after setting $randline to one that I know is blank:test -z "$myvar1" && echo "true" || echo "false"But, this returns "false"? So the string is not zero length. Why? It's a tab-separated file. Is awk storing the tab with the $1 field or something.This is where I get headache. I try to echo my variable to see what it looks like.
echo "$myvar1"
outputs: nothing
echo "My variable is [$myvar1]"
outputs: [y variable is [
Why is the closing bracket at the beginning? What character could be stored in $myvar1 that would do such a thing and how did it get there?
View 7 Replies
View Related
Oct 1, 2010
I just installed proftpd using webpin but when i tried to gonfigure it ,i figured out that the configuration file proftpd.conf is empty, is it about permission ?i just dont get it!
View 1 Replies
View Related
Apr 14, 2010
My cron job is executing the below mysqldump command but it produces an empty sql file. However, when I run from the command line, it works as expected.
Code:
15 6 * * * root mysqldump -uroot -pXXXXXXX mydbname | gzip > /home/dbbackup/db_`/bin/date +\%Y\%m\%d\%H\%M`.sql.gz
I'm on CentOS 5.4 and use "env EDITOR=nano crontab -e" edit my cron (then paste the above command.
View 5 Replies
View Related
Jun 17, 2011
I'm installing Wordpress and I want Hosting Multiple Sites with them. For that I need modify the httpd.conf file but it's empty. Where I can make that changes? These are the changes:
1. Type: LoadModule rewrite_module /libexec/mod_rewrite.so
2. Find the <VirtualHost> section in the httpd.conf file.
3. Find a line in the <VirtualHost> section of the httpd.conf that looks like this: AllowOverride None
3. Replace that line with this line: AllowOverride FileInfo Options
4. On a new line, type ServerAlias *.[URL].
5. Save the httpd.conf file and close it.
View 1 Replies
View Related
Feb 1, 2009
I just installed FC10 and then used yumex to install the vsftpd FTP daemon package. I'm using the vsftpd.conf file that came with the distribution, and its almost identical to one I copied from my FC2 machine's working set-up. When I try to FTP in as a known system user I'm presented with my home directory /home/myusername/. The directory appears empty to the FTP program, but isn't in reality. I can't upload a file to the empty home directory. I can move up the directory hierarchy to /home/, but again that appears as an empty directory.
I don't think it's a vsftpd.conf file issue. I've tried everything I can there. Could it have something to do with permissions? I fiddled with those, but couldn't make an FTP directory listing work.
[code]....
View 5 Replies
View Related
Aug 11, 2010
after update f12 to f13 geany stopped to work correctly on remote storage (sftp). Geany opens file correctly, but when I try to save, it saves empty file. I tried "notepad" and "gedit", they work good on f13. Geany on f12 worked correctly too.
View 3 Replies
View Related
Feb 19, 2010
I have set up a cron job in linux server using the command 'wget -q -o wget_outputlog url'
But on every run, an empty file being created at root.
How to stop this.
View 6 Replies
View Related
Mar 2, 2010
Does anyone know why files in my /tmp directory are not able to rm even using root login? not only that, I can't even chmod or do anything to files in /tmp directory... it always saying "read only file system" warning
View 8 Replies
View Related
Oct 8, 2010
Bash acts weird in 10.04 server. Whenever I try to run .sh scripts, every empty line in the script results in "command not found". Then on even simple scripts I get syntax errors, but the same exact scripts work on my 9.10 desktop installation. There's also another problem, I'm not really sure if it's bash-related. After setting the proxy using
[Code]...
View 5 Replies
View Related
Mar 2, 2011
I am trying to understand the join command. I wish to join two files:
Code:
$ cat test1
a 0
b 2.51
c 19.85
$ cat test2
a 0
b 2.51
[Code]...
this is great but I do not understand why join ignores the -e flag and fails to insert FOO in the empty field.
View 1 Replies
View Related
Jan 10, 2011
I'm in a directory containing various files and subdirectories, one of which is called BACKUP and is initially empty, what exactly happens if I launch the following command line:
Code: cp -R . BACKUP???
If I'm not mistaken, all the content of the current directory should be copied into the BACKUP directory, apart from the directory BACKUP itself. Actually I get a message saying something like:
Code: cannot copy a directory onto itself BUT when I look into the BACKUP directory I find another directory called BACKUP which I did not expect to find. Moreover, if I launch the same command again I get the same message (repeated two or more times) and then I find that inside the "second" BACKUP directory there is a third one, with the same name again. In other words, every time I launch the command I get a deeper tree of "BACKUP" directories, as if the command was messing everything up. I know that most probably I'm the one who's messing things up and I also know the "problem" can be easily bypassed by using as a destination for the copy a directory located elsewhere, but I'd like anyway to understand the reason for such a behaviour.
View 3 Replies
View Related