General :: String Of Text Conversion?

Sep 24, 2009

I'm writing a centralized logging piece, and I need to grep out logs that have specific date tags. The date command returns abbreviated months (Sep), via "#date -d yesterday '+%b'" but I need it all caps. ie SEP vice Sep. Otherwise the grep doesn't catch it

View 3 Replies


ADVERTISEMENT

Software :: Replace A Text String In A File With A Random String - With Sed ?

Sep 2, 2010

I 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?

View 14 Replies View Related

Programming :: Warning: Deprecated Conversion From String Constant To Char*

Jul 3, 2010

I've just updated my linux system (Debian) and went to compile some code I'm working on. However it causes some problems, presumable because of GCC up dates. I get many of my subject line errors for example

../../common/Version_Control.cpp: In function int VersionControl():
../../common/Version_Control.cpp:55: warning: deprecated conversion from string constant to char*

So I check up the error and it comes from my error handler code which is a function

extern void SetError(char *string,int error_number)

The net tells me all I need to do is convert char *string to const char *string, however when I do so and recompile I get the following error

Error_Control.cpp: In function �void SetError(const char*, int)�:
Error_Control.cpp:41: error: invalid conversion from �const char*� to �char*�
make: *** [Error_Control.o] Error 1

I think I've done exactly what's recommended ?

View 3 Replies View Related

Programming :: G++ Warning - Deprecated Conversion From String Constant To 'char*'

Jan 10, 2011

My problem is that the warning keeps apperaing when I run g++ compilation.

Say, I have a system runtime function with header (imaginary)sysruntime.h: void printfunction(char *line);

Then in my .cpp file, I will include the above header #include <sysruntime.h>

Then, I do the below:
Line12: char *linetoprint = "Print this line";
Line13: printfunction(linetoprint);

But, I will get the warning message "Line12: deprecated conversion from string constant to 'char*'". (Even though it compiles)

My question is how should I declare my char* so that I wont get this warning message, and can still run printfunction(char* line) correctly?

View 7 Replies View Related

Fedora :: Replace A String By A String In Text File?

Apr 26, 2011

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.

View 3 Replies View Related

Software :: Using Checkinstall To Make Eboard: Deprecated Conversion From String Constant To Char*

May 16, 2011

I am trying, using checkinstall to make eboard to enable use of this program with a DGT electronic chessboard (option not available in the program included in the repositories) according to the instructions given here. After the preliminaries, namely downloading and extracting the source from: [URL]-1.1.1.tar.bz2./configure runs fine but (after su-ing to root), both make install & checkinstall fail after numerous warnings about "deprecated conversion" like:

Code:

board.cc:55: warning: deprecated conversion from string constant to 'char*'
board.cc:157: warning: deprecated conversion from string constant to 'char*'
board.cc: In function 'gboolean board_expose_event(GtkWidget*, GdkEventExpose*, void*)':
board.cc:1414: warning: deprecated conversion from string constant to 'char*'
bugpane.cc:304: warning: deprecated conversion from string constant to 'char*'

View 4 Replies View Related

General :: Using Sed And Grep With A Text String?

Apr 28, 2011

Q: Is there any way to use grep and sed with a string variable rather than with a file?

The problem: Im running through a LARGE (about 10,000 lines) xhtml file and need to replace every instance of lines beginning <p>~

The following code works but takes a long time mainlly because an in/out operation needs to be carried out on each line. If I could read from a string rather than a file it would take a much shorter time!

Code:
#!/bin/bash
count=$((0))
>tpf
echo "waiting....."

[Code].....

View 4 Replies View Related

General :: Searching For Text String In All Files?

Mar 3, 2011

Is it possible to search ALL files on a system for a specific text string? I've been messing around with grep without any luck.

View 2 Replies View Related

General :: Get The Shortest String In A Text File With Shell?

Apr 29, 2010

Assume I have a text file as belowabcdaaaaaaagfgkhahahahahahhahhgfThen gf would be returned

View 4 Replies View Related

General :: Find Text After String Search In File

Aug 2, 2011

I have a file called Regions.ini that looks like this:

Code:
[Granite]
RegionUUID = 54ab7cd2-0e70-49b7-8020-8dbeb84c08d0
Location = 9991,10007
InternalAddress = 0.0.0.0
InternalPort = 9001
AllowAlternatePorts = False
ExternalHostName = 71.171.21.9

[Syenite]
RegionUUID = 8fc56fdd-0afd-4074-9432-0ae8f42b799f
Location = 9992,10007
InternalAddress = 0.0.0.0
InternalPort = 9000
AllowAlternatePorts = False
ExternalHostName = 71.171.21.9
What I need to do is find out what the IP address is after "ExternalHostName ="

After that I will need to compare that IP to whatismyip and if it's different then replace it but that is easy to do with sed. I just can't figure this simple hurdle out.

View 12 Replies View Related

General :: Replace Nth Occurence Of String In Each Line Of A Text File?

May 20, 2010

I have large text files with space delimited strings (2-5). The strings can contain "'" or "-". I'd like to replace say the second space with a pipe. What's the best way to go?
Using sed I was thinking of this:

sed -r 's/(^[a-z'-]+ [a-z'-]+) /1|/' filename.txt

View 2 Replies View Related

General :: Searching A Specific Directory For Files Containing A Text String?

Nov 20, 2010

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.

View 1 Replies View Related

General :: Use The Diff Command To Get The Difference Between A String Of Text And The Contents Of A File?

Mar 31, 2010

I am not especially cli adept so could someone tell me the best way to use the diff command to get the difference between a string of text and the contents of a file instead of between the contents of two files?

View 3 Replies View Related

General :: Sed/awk/grep Search For Number String Of Variable Length In Text File?

Jan 19, 2010

I need to search a text file for a string of numbers which are different lengths, and always are between number=" and " like:

number="1234567890"
number="22390"

I need to grab those numbers and pipe each one to a line in a file. I've already tried something with awk and that didn't seem to work.

View 10 Replies View Related

Programming :: Compiler Error: "Conversion From 'bool' To Non-scalar Type 'std::string' Requested"

Mar 5, 2010

As a result, I want to know what this error means, and how to correct it.Here is my code:

Code:

#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;

[code]....

It is once I use the 'try_crack' function inside of main that I get this error.

View 6 Replies View Related

Programming :: Put String On Top Of Text?

Jul 28, 2010

I want to create a script wherein it will put a string somewhere on the text file. I tried to create a script using redirect ">" and then put it on top of the file.

The text contains code...

View 6 Replies View Related

Ubuntu :: Get Text String Pathway Instead Of Button?

Oct 27, 2010

In the past, the filebrowser (nautilus) had a navigation-field with the pathway as text , but now there are buttons. I wonder how I can get back to the old-way.

View 2 Replies View Related

Server :: Remove String In Text File?

Jun 5, 2009

I have a text file which include code...

I mean, this string should be removed from each line and save in another file.

View 9 Replies View Related

Fedora :: Text String Come Up On Screen When Hibernate Selected

Feb 1, 2011

When I press the power button and select 'Hibernate' I get a text string come up on the screen. The last characters are "fail: -6". There is more to it but it's there and gone so quickly I haven't written the rest of it down yet. What this might be?

View 3 Replies View Related

Ubuntu :: Search All Documents Ending In .log For String Of Text?

Oct 27, 2010

I'm trying to search all .log files in ~/.irssi/irclogs/ and it's sub directories for the string 'irssi' and I had though the command I'd used for something similar before was.How should I edit the command, and is it possible to output every line found containing the string to file?

View 4 Replies View Related

Software :: Find And Delete String In Text Files?

Mar 6, 2010

I have a series of file names in a text file that I generated by running
Code:

bash-4.1# ls -alt *.txz | awk '{print $8}'
and then copy pasting the output. All of these file names have the version number
Quote:
-4.4.1-x86_64-1alien.txz

I just want a method to remove that version number from all the filenames so that I can then add all the packages without version numbers to a blacklist file.

I've tried kwrite and mousepad and both have a search feature and a replace feature but I haven't been able to just have the text removed successfully.

View 3 Replies View Related

Programming :: Find String In Text File And Add Something To That Line

May 26, 2011

I want to know how can I add something to a specific line.. the output would be something like:
abc
def 123
ghi

Search for string "def" and add something to that line.

View 1 Replies View Related

Programming :: String Format - Create A Text File ?

Feb 3, 2010

I am using C. I have a fuction that returns a string

Code:

I need to format this string so that I can create a text file like so:

So I'm trying:

Code:

But I get errors like:

View 2 Replies View Related

Programming :: String Search In Text File Using Visual C++

Jan 25, 2010

im tryin to make a tool in visual C++ which will take an input string through a text box,then it will compare tht string with a text file containing data and display the matched results in list box.

View 2 Replies View Related

Debian Programming :: Script To Execute String From Text File

Sep 24, 2014

I am having trouble writing a script that monitors a text file. When the file contains number 1 (or any other string that is not a command) it does nothing, but when it is something different from 1, it executes that command.

So, there are 2 files: monitor.mon - this is the file that will be checked constanlty; and test.sh - the script that does the job. The monitor.mon file will have its content modified by php. This means a web page will have a form where I input commands and writes does commands in the file. Test.sh will watch when the file's content changes from character 1 to a command, execute that command and write back a 1 so it will not execute it more times.

I tried combining while and if but with no success. Tried reading the file with cat and grep -e but it doesn't seem to recognize when content changes.

View 4 Replies View Related

Fedora Installation :: Text String To Enter To DISABLE Ip V6 100% During Install?

Feb 1, 2009

dose any one know the text string to enter to DISABLE ip v6 100% during the install?using the gui installer for fedora 5,6,7,8,9 i have been able to disable this ( uncheck a check box) then set the system up manually for ip4 .the reason is for some reason if ip6 is on during the install ( i have had this problem with all versions of fedora f5 through 9 and now 10)then fedora will never, never, NEVER ever connect to the net .the ip6 lookup kills my cable box, i boot into windows and it can not even connect until i unplug the box for 2 min and plug it back in and get a NEW/renewed ip address .so i do believe that i am going to need to do a text install and disable ip6. But the question is HOW ?

View 3 Replies View Related

Programming :: Find String In Text File (bash Script)

Apr 17, 2011

write such script (bash script). I have some text file with name filename.txt I must check if this file contains string "test-string-first", I must cut from this file string which follows string "keyword-string:" and till first white-space and save it to some variable.

For example. File: PHP Code: PHP Code:
Start 15022011 Eng 12-3-42
SN1232324422 11 test-string-first
SN322211 securities
HH keyword-string:123456321-net mark (11-22) 

[Code].....

View 1 Replies View Related

Programming :: Copy String A To String B And Change String B With Toupper() And Count The Chars?

Oct 22, 2010

copy string a to string b and change string b with toupper() and count the chars

View 3 Replies View Related

Ubuntu :: Bash Script To Delete/replace A Specific String Of Text?

Jun 17, 2010

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 Related

Ubuntu :: Sed - Searching Single And Double Quote Chars In Text String

Oct 27, 2010

I need sed to be able to search a string that includes both single quotes (') and double quotes ("). can anyone help me out, there has to be a way to do this.

So far I have tried:

But none of these work and I cannot think of how else to escape the sed quote inside of brackets.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved