General :: Shortcut To Remove First Character Of Multiple Lines In Gedit
Jan 23, 2010
I want to be able to remove the first character of a line when I highlight multiple lines in gedit. Example:
%Example is
%Commented Code
%Uncomment using this shortcut
I would then highlight/select these lines, and remove the first character to make it look like this:
Example is
Commented Code
Uncomment using this shortcut
I'm pretty sure there is an actual shortcut for this. If there is another text editor on Linux that it would work in, it would be nice to know how to do it in that editor as well.
I have a txt file with couple of comment lines: Number of title = !num! #line1 #line2 #line3
I wrote a script with "sed" to replace !num! in this file, which is very straightforward. However, based on the !num!, I want to remove the number of "#" based on the !num! value. Is there an easy way to do that with "sed"; otherwise, i will have to write a script to loop through the file.
I'm looking for a script (bash, python, perl etc) or even a one liner (sed, awk etc) that can take a set of files and remove any line that has more than "x" instances of any character (case sensitive). I have been doing a lot of searching and can only come up with examples of how to remove blank lines, lines that start with a certain character or lines that contain a certain string. This will be used on a system running a Kubuntu derivative.
As a very poor and basic example, I would like to take files that contain lines like:
Code:
And end up with the files only containing the lines:
Code:
If I tell the script that 2 is the maximun number of times any character can appear in any line.
I know this must be possible, but for the life of me I cannot find even an example that will lead me in the right direction or better yet a piece of code I can use.
My server was hit with an injection script which has placed code across many of my clients files. I need a script that can remove a block of php code that spans multiple lines, multiple directories/files and is dynamic, meaning that part of the code changes. I think using find/sed is what I need but cannot seem to figure out how to get it to work.The following is the script that is being injected everywhere. The catch is that they have generated dynamic code at the start/end of the script. (I have commented the parts that are dynamically changing on EVERY instance).PLEASE NOTE: Directly following this script is the start of a valid php script that I do not want to delete.
<?php //{{65281980 - DYNAMIC!! GLOBAL $alreadyxxx;
I want to remove duplicate or multiple similar lines from multiple files. I.e. if I have four files file1.txt file2.txt file3.txt and file4.txt and would like to find and remove similar lines from all these files keeping only one line from these similar lines. I only that uniq can be used to remove similar lines from a sorted file.
How to search multiple words in multiple lines, inside a directory including sub-directory? Pls. give easy example. I want to search the files (in /xx folder and all subfolders) that have header.h included and used x() function. I tried $grep -r "header.h" | grep -r "x(" /Folder/subfolder/ > search.log
I recently downloaded Metasploit framework for ubuntu but i got an error which says could not open <file location>
Saying gedit has not been able to detect the character coding. Check that you are not trying to open a binary file.Select a character coding from the menu and try again
In W7 and WXP when you tried to open an image or non-text file using notepad, the software would guess at the character encoding and show a bunch of gibberish. this allowed you to edit the image to make it corrupt or (what I am trying to do) hide a message or text within an image file and still have the image display. Is there any way to do this with gedit or another text editor in the repositories? I'd prefer to not use a command line text editor such as vim or emacs.
I have been trying to download a .tar.gz file for a while, and gedit says it has not been able to detect the character encloding. I am running Ubuntu 10.04 on an Acer Aspire 5730z.
I have been experiencing a problem where the screen loads and after initial first few lines breaks up into multiple repetitions of lines. Reloading helps but has to be repeated when pageing down. Mail is no problem; it is supplied by my network provider. OS is openSUSE 11.2 which I update when advised. Below is a sample from the error console:
as I found an easy way to create a shortcut for the terminal on the net, I was trying to apply the same method to create a shortcut for gedit, which is a great text editor that I use very often.I don't know what when wrong but I must miss something because it obviously doesn't work.Here is what I did:1.ran: sudo gconf-editor2. went to /apps/metacity/keybinding_commands3. Set "command_2" to "gedit" (I also tried with "gedit-2" as it is the name of it in the list of the applications in the apps folder)4. went to to /apps/metacity/global_keybindings5. set "run_command_2" to the key I wanted, <Control><Shift>g(I tried as well with other combinations such as <Alt>g, <Shift>g, no successAnyone knows what I didn't do or did wrong?(I suppose that it comes for the name of the command on step 3, but I don't know what could be the name to put (if you guys could also tell me where to find a kind of list for the names to put in, like for others programs, it would be nice)
I want to remove single quote from a variable. eg: Suppose I have a variable VAR='TEST' (including single quotes) How can I remove single quotes and make it TEST.
Anybody using Moneydance on 10.04 ? how to install it.
I downloaded the self installer with java *moneydance_linux_x86wj.sh* from their site as they recommended but when I try to install all I get is a Gedit error :- gedit has not been able to detect the character encoding. Please check that you are not trying to open a binary file. Select a character encoding from the menu and try again.
I have got certain files which somehow contain abnormal character "Del" "0x7f" or 177 which represents Del. And this is causing SVN to reject these files and abruptly end the process. I need to remove those characters from the file names but am not able to. find or grep do not search the files. This is how the file looks like with ls or find code...
know how to add a space between all the lines in a document using gedit? In order for a specific script I have to read each specific line, there must be a space in between them. And my current document has well over 1100 different things, and as such, having to add a space between each one would take awhile by hand.
In GUI style editors, you can generally select multiple lines, press tab a few times to move all the lines across (or shift-tab to go back). I have no idea how to do this in VIM.I googled around and couldn't find any straight answer to I came here.
Can anyone help me get the position of the first and last non-missing data characters (while allowing missing data characters in the middle of the sequence)? I'm sure it is a simple sed or awk command but I can't figure it out. I think I can produce the output file I want once I have figured those commands out.
My ultimate goal is to write a script that can make composite sequences from two or more non-overlapping sequences (e.g., the two sequences from NEOM). I may also want to merge sequences that partially overlap (e.g., those from TEST) but that would complicate things. Is this a logical first step for such a script or would you do it differently?
I've seen a few tutorials that have commands and parameters on multiple line, like the one below:
Code: chkconfig --levels 235 mysqld on /etc/init.d/mysqld start
I can copy and paste this in Putty, but what if I want to manually type it? If I press return, the first line gets processed, so how do I insert a new line?
I need to filter the log from a massive wget. I want to remove the progress lines and only leave the last one. Now each progress line starts with a newline '
I have model output data in ascii format. It contains thousands of lines. The output file contains multiple text lines with variable values. here I copy-paste some of it's contents.
I have a list of words that I want to grep in many files to see which ones have it and which ones dont. in the text file I have all the words listed line by line, ex: list.txt:
check try this word1 word2 open space list ..
I want to grep each line one by one. like I want it to
grep "check" *.log grep "try this" *.log grep "word1" *.log .. etc how can I do this?