Ubuntu :: Put A String Into An File?
Mar 29, 2010I have a file with this text inside: 1, I want to put the string 2, inside it The file then will contain the string: 1,2, Can this be done with the cat command?
View 8 RepliesI have a file with this text inside: 1, I want to put the string 2, inside it The file then will contain the string: 1,2, Can this be done with the cat command?
View 8 RepliesI have a String that I would like to sign using a given RSA Private key. I thought this would be relatively easy but I have not been able to find out how to do it, unless I'm looking to far into a simple problem. Do i have to put the string into a file, and sign the file, or can i just sign the string/message?
View 7 Replies View RelatedI have a line in a text file that has 40 random characters within a tag and i want to change the characters to a new set of 40 random characters (alphanumeric a-z 0-9 etc)
The line in the text file looks like this:
Quote:
How would i go about doing that?
Also second question same as the above but how would i remove them instead of replacing them?
If I have a word in a text file and I need to replace it by another word (for example, i need to replace abc by fff) so what is the command I can type it?
I am using vi editor.
copy string a to string b and change string b with toupper() and count the chars
View 3 Replies View RelatedHow to find filename and file path from a string
View 7 Replies View RelatedI need to parse the file of same name which exist on different servers and calculate the count of string existed in both files.Say a file abc.log exist on 2 servers.I want to search for string "test" on both files and calculate the total count of search string's existence.For example if file abc.log on server 1 has string "test" 2 times
and file abc.log on server 2 has string "test" 4 times.then the output will beStringName : Countexampletest : 6 timesNote : I have created the password less connectivity using ssh-keygen.
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 RelatedMy script.
This is may script:
Code:
Problem: Output file doest not exclude the values in grep -av
I have script that I'm working on that updates a username in all the files that are called blah.inc for my framework. since i host a bunch of these web apps i need to do it to all of them. so I need to figure out how to update these files automagically with out me watching it to call vim every time. heres what I have so far
Code:
This finds the files but now i need to figure out how to do s/bob/fred/g on those files.
I would like to know how I can replace a string in one file with the complete contents of another life.
View 10 Replies View RelatedOK I have a simple script that does:
Code:
# Create temporary file:
pwFile="~/Tmp/temp.cnf"
echo "$password" > "$pwFile"
But I get an error message:
Code:
~/Tmp/temp.cnf: No such file or directory
I have a file in which I have string called "already there" in some line of it. I want that if the string is present enter some loop..
like
if(( grep "already there" $file is true ))
then
--
--
fi
But the thing is when I make grep it gives the whole line in which this string is present and gives some error: if[ grep "already there" file ]: command not found. I am very new to shell scripting.
I've found some scripts that replaces a string in a file but it's not quite working for me.
And I'm trying to replace a tag in an xml file that looks like this
So I ran a command line like this perl -w -i -p -e "s/xmlns="'http://mydomain.org/replacethese.xsd'">/>/g" testfile.xml
And I get a error output
Search pattern not terminated at -e line 1.
Found the script from this blog [url]
I need a hand with a line of terminal commands. I need to be able to search a given .sh file in a given location for a string, and when found, add a "#" to the start of that string and save the file back to it's original location.
View 1 Replies View RelatedI've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.
[Code]....
One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?
Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.
I am trying to remove all the files in a directory hierarchy which a certain string inside the file (not the file name, it is the file content).
I can list out all the file name which has a string in the file using 'grep -r -l mystringlooking for'.
But how can I remove all the files returned by the grep ? I am trying this on ubuntu.
I am searching for Class declaration on a site with hundreds of PHP files, how can I do this in the current folder and subfolders using GREP?
I tested cding to the folder and then something like
grep -r 'class MyClass' *.php
I want to write some code to search for a specific string in a text file, but without using grep command.
View 5 Replies View RelatedI have a string like $(SOMETHING) and want to remove '(' and ')' in a script file. How can I do that? I read that sed command is a filtering utility but don't know how to use it.
View 12 Replies View RelatedI have a text file which include code...
I mean, this string should be removed from each line and save in another file.
I am trying to remove everything before my string code...
View 9 Replies View RelatedI know how to replace a particular instance (say 3rd one) of a word in a line using sed based on the sed one-liners. However I would like to replace a particular instance of a word in the entire file.
For example, here is a file:
Code:
John
Betty
Jack
Ron
Jack
Paul
So now I would like to replace the second instance of Jack (in red color) with "Rob" (for example). Not quite sure how to do that? I tried couple of things from here but they did not work.
I have question about replacing a string in a file.
How can I replace the printerb's 10.1.1.1 to something else(10.1.1.2, for example) without replace printera's 10.1.1.1 accidentally?
I have tried perl -e -pi "s/10.1.1.1/10.1.1.2/g" /etc/hosts. but, perl replace both 10.1.1.1 to 10.1.1.2.
I need to read a file and parse a string. I know in Perl there is the split command. Is there something similar to that in C++?
View 6 Replies View RelatedWhat's the easiest way to search for a string in a text file in GNOME or on the console? I used to do this in kfindfile back on KDE.I'd like to avoid downloading something like desktop search if at all possible because I'm away for the holidays and stuck on a dialup connection.
View 5 Replies View RelatedI 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 RelatedAssume I have a text file as belowabcdaaaaaaagfgkhahahahahahhahhgfThen gf would be returned
View 4 Replies View RelatedTo be specified,what I want to do is:
if I create xxx.php,#!/usr/bin/env php will be the first line of the file
if I create xxx.py,#!/usr/bin/env python will be added first.
I am having difficulty getting sed to replace a string of text in an XML file, despite the fact that I have no trouble using grep to find that same string. Since the new string and old string to be replaced contain a lot of special characters, I thought it best to store them in variables as opposed to using a slew of backslashes:
OLD_STRING='<property name="webServiceHost">${jboss.bind.address}</property>'
NEW_STRING='<!--<property name="webServiceHost">${jboss.bind.address}</property>-->'
[Code]....