As much as I didn't want to ask a sed question, especially considering there's already one on this page I've looked as best I could and cant find the solution. Id like to use sed to replace occurrences of a pattern but exclude two or 3 specific lines that are not consecutive. For example I know with 1,10 i could exclude the first 10 lines, what is the syntax if I just wanted to exclude line 3 and 7. The sed command I'm working with right now is for rearranging Ethernets.
cat /etc/udev/rules.d/70-persistent-net.rules | sed -e '/'"$found1fullmac"'/!s/eth1/'"found1eth"'/' > /etc/udev/rules.d/70-persistent-net.rules
I would like to replace $found1fullmac with two variables representing line numbers to exclude from the replacement.
I am a member of a group which has written a program whose source code is being held in a specific directory (~cs252/Assignments/basicAsst/project) and we want to go through and change the parameters for the function "sequentialInsert." My job is to find all occurances of the function call to "sequentialInsert" and to also list the files from where the code came from. Also, I have to be in the commandsAsst directory when I do this. I have tried grep and find combined together, and I am at a lost.
How do I give permission to a logged in user to stop/start a specific service without entering a root/sudo password? So they can do a simple "service SomeService stop|start" It is for a headless Ubuntu server.
I need to search a bunch of files in a specific folder for a specific number and add all the numbers together to a total sum. I use Rsync everyday, everytime I run rsync i get a logfile (rsync output) witch contains the textstring "Total bytes sent: xxxxxx".
The "xxxxx" can vary in lenght. I need to extract the "xxxxxx" from each file and add the numbers together to a total size over a week or a month. Is this possible? And I wish to only use bash. One way of doing stuff at a time my friends .
my system I want user1 and only user1 to be able to mount and unmount a specific partition, this partition contains backups and is usually mounted read only, needs to be temporarily mounted read/write by user1 while doing the backup.user1 is an unprivileged user. I've read that the user option will let any user mount the file-system (and only that user can then subsequently unmount it) and that the users option allows any user to mount or unmount the file-system.I also found this in mount's man pageQuote:The owner option is similar to the user option, with the restriction that the user must be the owner of the special file. This may be useful e.g. for /dev/fd if a login script makes the console user owner of this device. The group option is similar, with the restriction that the user must be member of the group of the special file.So it looks like I'd need a login script for that user to make the user owner of the device file (/dev/voiceserv/backup in this case)
I'm trying to configure our mail server to block email from a specific sender reaching a specific recipient. In other words, if one of our employees is getting harassed by a 'stalker', how would one go about blocking, at the MTA (Sendmail) level, a specific sender email address from reaching a particular users inbox? We do not want to capture the email - simply block it before it consumes server resources.The Sendmail server (MTA) is a front end to our Exchange server so no user accounts exist on the Linux server. We simply use it as a SPAM and Virus scanner then forward clean email to the Exchange server.
I want to record an internet radio station starting at 2:00am tomorrow morning. The specific program on the radio station lasts until 6:00am. The command I need to run to record the station is: Code:mplayer http://wjcu.jcu.edu:8001/listen.pls -ao pcm:file=indie_heat_of_the_night.wav -vc dummy -vo nullI'd use cron, but 1. I'm not sure how to and 2. it seems unnecessarily complicated for something that I only want to run once. If cron is the only/easiest solution, I guess I'll just have to resort to that, but I'd rather not.
You know how nano, vi, vim, etc... all use the entire screen when they are started? I am wondering if it is possible to get a text editor (or modifying an existing one) that doesn't take the entire terminal. The reason for this is that I to look at the output of a different command, then modify a different file while looking at the output. I want to be able to do this very fast, and it would be great if there was some way I could this all in one shell instead of creating two terminals and resizing or flipping between them. I realize the ideal solution would be a second monitor, but I can't get that right now.
I have a text file which stores the list of files & dir, I want to get only file's extensions from this file & want to store it in another file.eg, below is the file's contents & from it I want to get the extensions sh, pl & h & want to store it in another file. Also I don't want directory list.
A scripts/services_restarter.sh A scripts/svn post_commit scripts A scripts/tmp/
i have never tryed programming anyhing. i was wondering inhow i can start learning python. i use archlinux with openbox. do i need any specific tools or jsut a text editor? sorry for the noob question . from the tutorials online i see many tools like pygtk glade and so on and i cant understand anything
I'm working on a new conky script, and I had the idea to use text from a [URL]... The command I'm using to pull the file is:
Code: curl -s http://www.thefuckingweather.com/?zipcode=33186 | grep 'ITS FKING *' However, this gives me the entire line of code this line appears in. Code: <br />ITS FKCING NICE</div><div id="remark"><br /> How can I limit this to simply the text?
Sorry about the foul language btw...the words obviously aren't misspelled when I enter them in the terminal
What i want to do is pretty simple.I want to uncomment every line that begins with "deb" (except for deb cdrom) in /etc/apt/sources.list.I know how to do this through system > administration > software sources.I know I can gksu gedit /etc/apt/sources.list.I'd rather not do it that way.I'd rather have a script do it. It's less work, less typing, less clicking, and would work the same on every ubuntu version.
I want to remap my keys for a game I'm playing, for example WASD instead of arrows to walk, r, f, c to act like f1, f2, f3 and so on. I'm aware of xmodmap, but I want to do this just for one application and be able to use hotkey to toggle between this script and default setting. I've been trying to use AutoKey, but I cannot force it to work just for specific app. On windows solution is AutoHotKey, but it won't work through wine.
Is there a way to change my resolution to something specific? I was trying to make my display "less-widescreen" when I accidently made it completely changed.
From the sax2 command, there is only 1400*1050 and 1600*1200, both that are not what I'm looking for and messes up my display. Now, I can't change it back to the original, much less the one I'm looking for (1600*900).
I am using Ubuntu 11.04 - the Natty Narwhal with GNOME 2.32.1. I want to change icon of specific file type (like all files having .py or .pl extension). I Google it and have tried all the possible methods but nothing works
I want to change the resource limits for a specific processOr to create a new process and give it limits as I want, There is a function setrlimit, Which is possible to change it but for a programmatic I want to apply it to another Process, The problem is that this function does not receive process ID for example. I read in most books on the subject of The Linux system programming
I have a specific NTFS partition on a USB drive that I wish to enable execute support for. The only way I've found to do this is to add the partition in /etc/fstab with a umask. This poses some problems:
1. Only root can mount it, making it a pain to mount (open terminal, `sudo mount (path from /etc/fstab)`, enter password, close terminal). 2. The system will hang at start if the UUID is unavailable (or, the external disk is unplugged). I run several servers from my machine, so if I do a remote restart it will not come back up because of the hang.
Is there a way to specify to FUSE (which I believe is the handler for auto-mounting in Nautilus) that this partition should have execute access to files?
I have a vary unique problem with file and directory ownership. I need to change the ownership of multiple files and directories under a specific subdirectory.Under this directory structure there are files and directories owned my different users and groups. I need to change all files and directories owned by "user1" to "user2". but if any are owned by "user3" I need those left alone.Is there a simple way to do this or will I need to traverse the structure and change things one at a time.
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.