General :: Repacing A String At A Specific Location With Another In Vi (gVim)?
Mar 18, 2010If i have a comma separated string like this one
Code:
aa,bb,cc,dd,ee
11,22,dd,3f,22
[code]....
If i have a comma separated string like this one
Code:
aa,bb,cc,dd,ee
11,22,dd,3f,22
[code]....
So if I'm given a location of a file like:
How can I just take the type of the file at the end? I know I can use strrchr() for a period to get the pointer to the period just before file type. Is there a build in string function that will just take the rest of the string from a certain point on forward in the string? I know it wouldn't be much work to make it myself, but I figured I would find out if it already existed before doing it.
How do i delete a specific string in vi? Suppose i want to delete only the instance "ing" occuring in a file through vi , how could i do this??
View 3 Replies View RelatedHow can you remove files containing a specific string?I have...Code:find |grep 'string'This may return several results and I wanted to rm the results.I also have...Code:ls -l |grep 'string'|awk '{print $9}'which also may return results.But point is, I can't supply the results as a parameter to rmI was thinking of looping but I don't know how to access the results as if they were an array or something.
View 5 Replies View RelatedIs there any way i can find a file with specific word inside it.For example if i want to find a file which has some text written inside it.How would i form a command to search them?
View 5 Replies View RelatedI 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.
View 1 Replies View RelatedIn Fedora 12/11 there used to be a button in the Nautilus to the left of the address/location bar which would let me switch between two representation of location bar: 1) buttons 2) as string that I can type in.
In Fedora 13 I cannot get the same behaviour. The button is missing and location only shows up as a set of buttons.
I have looked in the settings of Nautilus, but couldn't find anything related to this. How do I get location bar to show up as a string where I can manually type the path?
These must a be a question you received a lot, but I couldn't find a similar thread! It's a simple question.
I need to delete a specific string from a file. For example the specific numbers "3456" from a file. I've tried with the tr comand, using
Code:
tr -d '3456' file,
but it also deleted whichever ocurrence of 3,4,5,6 from my file. Should I use a regular expression?
Yesterday, I downloaded qt and gcc by using "synaptic package manager" tool.Where does those programs intstalled?Well, in windows the programs are installed in c:Program Files folder. Similarly, is there a specific folder that the newly installed programs are placed?
View 4 Replies View RelatedHow to write a value to a specific memory location in C language and how to access the same value ?
I am trying the same on fedora linux and i am trying to write the value to the 32-bit address.
I have a script that among other things generates a makefile with an error that causes make to fail. specifically, the string "-Wimplicit-function-dec" should be changed a bit to "-Wimplicit-function-declaration". Is there a way to have bash add the new eight characters in the right place (on line 105)?
View 2 Replies View RelatedI want to append a variable string to the end of a specific line. not like append the same string to each line. like in my file i have 4 columns, i want to add a string in 5th column in some fixed row.
View 4 Replies View Relatedhow to search for a specific string of text inside an html document. I then want to cut out that specific data that the field or string contains. I want to do a shellscript that makes this function automaticly.
For example:
#
#Here i want to find the field "town" inside the html/java and then cut #out the town name from it and paste that to an file.
#
#
[Code].....
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.
View 8 Replies View Relatedcopy string a to string b and change string b with toupper() and count the chars
View 3 Replies View RelatedRecently, I've installed vim like so:
hg clone https://vim.googlecode.com/hg/ vim
cd vim
sudo ./configure --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-gui=gtk2 --prefix=/opt/vim
make
make install
make install clean
So, my VIM's binaries now live under /opt/vim/bin. Here is ls -la of this dir:
[Code]...
set lines=999 columns=999
doesn't work, and
au GUIEnter * simalt ~x
only works for Windows.
I want to replace a string of directory path in a string to empty:
Code:
But this doesnt seem to give me the desired thing:
Code:
This gives the desired outcome, but its specific, i need a variable in the sed not a string. And if I replace STRING="/mnt/sda1/record/$dd/" then I cant use it for something else, cause its has all the weird backslashes now.
I use a terminal with white text on black background (I just like it better), so I wrote the following line in my .vimrc file: set background=dark
However, gvim has black on white text. How do I do either of the following: Set the background of gvim to black Check in .vimrc if I'm using gvim I tried this: I started up gvim, and typed echo &term. The answer was "builtin_gui". So I wrote the following into .vimrc:
if &term == "builtin_gui"
set background=light
else
set background=dark
endif
Somehow, it didn't work.
I'm using SSH (with -X specified) from a Ubuntu box to a RHEL4 box and running GVim. It opens as expected in my local X, but the copy and paste via select doesn't work. I cannot select text in GVim and paste in a local window, nor can I select text from a local window and paste in GVim. This works, however, when I SSH (with -X specified) to a different RHEL4 box. Is there something I need to install on the remote machine? I am running Parcellite 0.9.2 on the local box, but closing it doesn't make the problem go away, and it is not interfering with the other box.
View 1 Replies View RelatedI loved Gnome's Nautilus and FTP integration and being able to mount a remote FTP directory as a regular bookmark/directory, and double clicking any remote files to open in any unmodified program. I also loved editing text files with GVim.
However, if I double clicked file on Nautilus to open a text file in Gvim, then saving a file will take about 10 seconds and GVim will hang for that amount of time. The major irritant is that I cannot continue editing while the text editor is waiting for the write to finish, this delay interrupted my workflow and thought process and saving becomes a painful process. The other problem is that I don't think simply uploading a file should take that much time.
I'm aware of GVim's internal FTP support, but they are not as well integrated with Nautilus's FTP and it suffers from the same problem.
So a few question:
Is there a way to make GVim or GVFS to save in background while I continue editing?
Why is GVFS so slow? Is there any way to set GVFS to use a single persistent FTP connection instead of creating a new FTP connection each time?
I'm on Gentoo Linux x86-64.
i have a file name using the following pattern:
PREFIX: AR
SOURCE: LEGACY
DATETIME: YYYYMMDD_HH24MISS
SUFFIX: .txt
sample filename:AR_LEGACY_20101104_105500.txti want to extract the source which is LEGACY in this case. how do i do this using shell?
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 RelatedI want to generate HTML files in batch to show some gvim colorschemes in action. I took my current solution from the script at but this will open open a gvim window for each colorscheme I want to process. So far, the only way I have found to avoid the annoying new windows that pop up every second is to start a VNCserver and set the DISPLAY environment variable to that of the VNCserver so that all gvim windows are sent to the display within the VNC session.However, I would like to know if there is a way I can avoid the whole VNC setup and just run a headless gvim instance that does the conversion and exits, with no windows ever being actually displayed.
View 1 Replies View Relatedfor example
else {
for fileDOC in $location/*.doc
do
[code]...
I use kubuntu (8.04) which does not have a root account.
[sudo] password for ts:
However, starting xclock or gvim on root shell on konsole has the "Can't open display" error appears.
Error: Can't open display: localhost:0.0
Press ENTER or type command to continue
i use this script to get the time and date of back and fourth transactions for a particular execution id. I use a substr command on the 5th column to to cut the milli seconds off the time value. - otherwise the times would look like 08:30:04.235
grep <executionID> <auditfile> | awk '{ print $1, $2, $3, $4, substr($5,1,8}
FIX -> Mon 3/1/2010 08:30:04
FIX <- Mon 3/1/2010 08:32:36
FIX <- Mon 3/1/2010 08:35:08
[code].....
anyhow - i append two sed commands to further clarify the direction of the message.
awk '{ print $1, $2, $3, $4, substr($5,1,8} | sed -e 's/->/ ->IN/g' | sed -e 's/<-/<-OUT/g'
FIX -> IN Mon 3/1/2010 08:30:04
FIX <- OUT Mon 3/1/2010 08:32:36
[code]....
I tried using an awk gsub () command within the string instead of the two seds, but it did not work:
awk '{ print gsub(/<regex>/, <replace with>,$1), $2, $3, $4, substr($5,1,8}
the sed works ok, but it would be cooler to make the replacement within the awk command:
gsub(/->/,-> IN, $1)
Is there a way where i could replace the value of the $1 column in the awk print string?
Moving right along, I have a folder of MP3 files containing various Movie sound tracks and scores. I'm using Audio Tag Tool to tag all the files at once with an "Artist" of "Soundtrack", and to inherit the "Title" tag from the file name. After that, I will rename all the files (Using Audio Tag Tool -- awesome program, btw) with the format "<Artist> - <Title>.mp3"
The problem, is many of my files already contain the string "Soundtrack", which would be redundant. I happen to be a perfectionist, so I'm unable to ignore it and move on. Hence my question to you fine folk: I want to delete all instances of "soundtrack" (-i case irrelevant) in the filenames before I go through the above steps. But, its not quite that simple. This is a sample of some of the file names:
[Code]....
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.
View 12 Replies View RelatedI'm working with a program that uses Open Motif to create all of the widgets, including the Open File dialog box (obviously). However, Open Motif being kinda old-timey, 80's vintage, and for the most part now an abandoned project, it is quite clunky. So, actually what I need to do is to open some files located on my work server. I have already successfully connected to the relevant server directories with Samba, and with programs built with GTK+ (such as GIMP) I can open files across the network because I have created a bookmark in Nautilus, and those bookmarks appear in the Open File dialog box created by GTK+. Now, Open Motif is different: it doesn't see network locations, orNautilus shortcuts. When I type "smb://serveripyadayada" in the search folder, it really doesn't like it and complains. So, what do I do? Can I get somehow Open Motif to open a network location? Or can I do a run-around and place a shortcut in the file system that points to the network location?
View 2 Replies View Related