General :: Substitute In A File What It Comes With "(" Character To "?

Apr 21, 2010

i want to substitute in a file what it comes with "(" character to "('". i have tried to do it with gsub but it doesn`t go well with regular expression.

View 4 Replies


ADVERTISEMENT

Programming :: Sed Substitute Everything Until Character?

Mar 30, 2010

I have the following file:

Code:

1 line
...
49 test test=AA:AA:AA:AA:AA=0

I need to substitute on the line number 49, all text until =. I have used the following, but with no actual result.

sed -re '49s/^.+=//' file
and
sed -e '49s/.*[=]//' file

View 5 Replies View Related

Programming :: Substitute 2 Character Country Abbreviations To 3?

Dec 20, 2010

I have a list of 2 character country abbreviations used in the Maxmind GeoCountry database that I need to convert to the standard 3 character country abbreviation ISO 3166-11 format. I could have a long list of sed substitute statements for each country.

Code:

sed "s/US/USA/g" <file>

Is their a more elegant way to do this? Maybe an array of some sort? This substitution will be used in a bash script.

View 4 Replies View Related

General :: Substitute In A File When Sed And Awk Both Fail ?

Jun 5, 2011

I have tried making this substitution using both of

Code:

Sed operates with no comment but does nothing. awk objects to the variables content because they include the occasional non-breaking-space. The presence of these is essential so that bash will properly distribute the content of each line to an array.

The content of "orc" and "orch" is as follows (the non-breaking-spaces show as *).

Code:

View 2 Replies View Related

General :: Use The Man / Info / Apropos Pages - Character Instructed The Shell To Interpret A Special Character As An Ordinary Character?

Mar 27, 2010

1.What character instructd the shell to interpret a special character as an ordinary character?

2.What directory contains some of the utilities available on the system in the form of binary files?

3. What command is used to search the location of a utility?

4. What command is used to instruct the editor to write the file and quit the editor?

5. What key quits the more utility and displays the shell prompt?

6. What command starts a child shell as the super user, taking on root's identity and environment?

7. Which wildcard characters can be used for searching all the files in the system that start with "A"?

8. The user name or login name of the super user is????

[Code]....

View 10 Replies View Related

General :: Change File Character Set?

Aug 9, 2010

I would like to know how I can change a file so it has the same character encoding as files saved as comma separated csv files from Microsoft Excel.

I have tried using iconv to do this. code...

View 5 Replies View Related

Programming :: Substitute Text From Master File?

Mar 29, 2010

i have a PHP program, it encompasses about 200 scripts. Years ago, it was rewritten by another programmer to be multi-lingual, but the multi-lingual attraction of it never took off. Now that I am the only maintainer, trying to reuse what I have for code is quite difficult. If I look at one script, I see items like

_HEADER_TEXT_ERROR_4
_TABLE_ROW_SIZED_FORMAT
_ERROR_SELECT_RADIO_MAIN

All of these (and many more) are found in a "main.php" file that sort of go like this:

DEFINE _HEADER_TEXT_ERROR_4 "You Entered a Bad Value";
DEFINE _TABLE_ROW_SIZED_FORMAT "Last Name";
DEFINE _ERROR_SELECT_RADIO_MAIN "Make Your Selections";

What I would like to do is have something that says FOR all files in this directory, when you find something that starts with _, find that value in main.php and substitue what is inside the quotes for that value. Sort of unwriting all this multi-lingual stuff. I can format how I would do it if it was all stored in MySQL, but doing it from bash has me perplexed.

View 11 Replies View Related

General :: Remove Abnormal Character DEL From A File Name?

Jul 22, 2011

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...

View 3 Replies View Related

General :: Tool To Convert A File Of HEX To ASCII Character Set?

Feb 10, 2011

Is there a known tool to convert a file consisting of 2 byte Hex into ascii?

Note: - Maintain file offset listing in bytes code...

View 3 Replies View Related

General :: How To Ignore Rows With Specific Character In Csv File?

Mar 11, 2010

I have a csv file that has around 3 million rows. I want to process this file so that it creates a new file that contains only the rows that have 2 characters or less in the first column column.At the moment i am using SQL Loader but its taking too long so im wondering whether this would be easier if done in Unix?

View 8 Replies View Related

General :: Substitute Pattern With Another Patter In Vi

Apr 24, 2009

I have the large file (textfile) there are word:

code-007100
...
code-007199

How to substitute those all words, so it will change all instances to:

code-007200
...
code-007299

View 5 Replies View Related

General :: SED - Substitute A Word Only In A Certain Line

Feb 2, 2010

I tried to use the command:

sed -i ''$line_number',/port/s/port/portMARKED/' file

to substitute the word "port" by the word "portMARKED" at the specific line that is saved in "line_number". The substitution happens, but it is copying my line twice... and I have no idea why... I need to make a single substitution of one word for another at a certain line in my text file. Would somebody know how I could do that?

View 3 Replies View Related

General :: Substitute Variable In Bash

Mar 21, 2011

Assume that i a having the following three lines in an executable file

#/bin/bash
a=Tue
Tue=1

When i give echo $a the value should be 1, how to do this.

View 8 Replies View Related

General :: Split A File, Byte-wise, Not Character-wise?

Nov 17, 2010

I want to split file foo into two parts, and I only intersted in the first one. But the N bytes in which the first part consists, I want it to be an exact replica of the corresponding bytes of foo. More exactly:

Code:
foo foo1 foo2
==============================
90 90 05

[code]....

View 4 Replies View Related

General :: Bash: Substitute Parameter In A Quoted String - Stored In Another Variable

Jan 31, 2010

(variable substitution?)
(parameter expansion?)
Code:
run_repeatedly()
{
NUM=0
while [ <irrelevant stuff here> ]
[Code]....

run_repeatedly "programX -o "./messy/path/output-$NUM.txt"" The echo inside the loop prints "...-$NUM.txt"; obviously I'm aiming to have bash substitute the iteration number so that I end up with many output files not 1.

View 5 Replies View Related

Fedora :: Grep A File For Each '#' Character And Utf-8

Aug 15, 2010

I want to grep a a file for each '#' character that starts a line, the thing is the file is utf-8 and it starts with some some characters 'ef bb bf' is there a way to have grep to work with utf-8 files ?

[Code]....

View 2 Replies View Related

Programming :: C++ Character Search In Text File?

Jun 23, 2011

Im trying to read a file in c++ and search for particular character for example if this is a list that I have:

Alice
Bob
David

[code]....

if the input is D, it should give David, if its B, gives bob. so in this case, meaning it reads the first character of every line. but if possible I want to make this dynamic so the user can specify which character position he is looking for, so in case he is looking for R as character index 3 in all lines, it should give Charlie. but the problem is, it does now recognize , besides, I do not know how to specify the character position in each line.

here is my code

Code:

#include <iostream>
#include <fstream>
#include <cstring>

[code]....

View 1 Replies View Related

Programming :: Check .xml File And Which Character Is Malformed In 'utf-8'?

Jun 15, 2011

I need some software that will check .xml file and tell me which character is malformed in 'utf-8'. I am using perl for some parsing.

View 2 Replies View Related

Programming :: Sed To Change Character In Text File Only Once?

Sep 7, 2009

I have a script that looks like:

Code:

cat servers.txt
trivia:P:N
trivia:D:N
tucana:P:Y

[code]....

I want to be able to find the lines that matches my input and change the N to a Y, but only for the lines that matches the name and not any other N's My problem is the line does not always contain a P as it can be a D as well so my matching did not work. If my script issues the name $1=triva the lines will change to:

Code:

trivia:P:Y
trivia:D:Y

I have the following code so far but as you can see it does not change the D's

Code:

sed -i 's/trivia:P:Y/trivia:P:N/g' servers.txt

*** UPDATE ***

should I be using a method as follows? I am still stuck on the changing all instances though.

Code:

$1=server
sed -i 's/$server1:P:Y/$server:P:N/g' server.txt
sed -i 's/$server1:D:Y/$server:D:N/g' server.txt

View 7 Replies View Related

Software :: Deleting All Instances Of A Certain Character From A Text File?

Feb 18, 2010

In my command prompt I did:

Code:

sed 's/://' mytextfile > newtextfile

But it only deleted the first instance of : in each line when some lines have multiple : appearing in each one. How can I delete all the : from the entire file?

View 6 Replies View Related

Red Hat / Fedora :: Change File Names To Remove Invalid Character

Apr 1, 2009

I am trying to copy a large number of files from a Linux server to a Windows file share. Unfortunately, all of the files and folders I have to copy have 10 numbers followed by 2 colons "::" in the name (example: 1234567890::WordDoc.doc) which of course is invalid in windows naming conventions. So now I'm trying to come up with a way to change the file and folder names on the fly to replace the colons with a dash "-" or space " ". I'm even willing delete the frist 12 characters in necessary. I have tried cp, mv, tr, and several -bash scripts but get no positive results.

View 4 Replies View Related

Programming :: Bash Scripting - Parsing Text File By Character

Aug 11, 2009

Is there a way to process individual characters one-by-one from a text file in Bash, or is that hoping for a little too much from this lovable old clunker?

View 13 Replies View Related

Programming :: Shell Script Comparison For Two File(text) Character Wise?

Mar 1, 2010

I need to write a shell script which can compare two files(text files) character wise. eg. underscore is space.

------FILE 1---------------
A_B_C
D_E_F
G_H_I

[code].....

Actual problem: I need to write a shell script which can give me difference character by character not by line (using comm)

View 4 Replies View Related

Ubuntu :: Frozen Panel - Messing Around With The Alternate Character Panel App And Made A Custom Character Set

Jun 12, 2011

I was messing around with the alternate character panel app and made a custom character set. I then wanted to put it on a new panel and created a new panel. I moved the character set to that panel, and then started to mess around with the panel settings (auto hide, show hide buttons, and expand, to be specific.) So far so good, until I moved the panel from the right side of the screen to the top. I already had a panel here, and it seemed not to like hiding a panel when there was already one on the top.

When the new panel hid itself, all my panels stopped responding (any clicks on them did nothing) and my processor started going at 100%. I tried a reboot and the only thing that changed is that now I can't even see my panels. I'm guessing I need to change the settings back manually through the prompt, but I don't know how to do that. I am using 10.04 and have not upgraded gnome since upgrading to 10.04.

View 1 Replies View Related

Programming :: Text File Replace Occurrences Of Three Character String ZZZ With Quotation Mark

Mar 30, 2010

I want to use SED to do the following: In a text file replace any occurrences of the three character string ZZZ with a quotation mark "and. replace all occurrences of a comma with a semi-colon. It is the S/ / / command which is stumping me on the first issue...inparticular how to get the replace string to be quote.

View 9 Replies View Related

Ubuntu :: Missing Character Set - Install Instructions (if Any) Needed Font File Name Is ARIALUNI.TTF Owned By MS

Sep 28, 2010

where to get the character set that includes this character "〪" and the install instructions (if any) Needed font file name is ARIALUNI.TTF owned by MS

View 3 Replies View Related

General :: Substitute For Nokia PC Suite Or Synchronizing Data From A Nokia Phone

Apr 1, 2011

I was looking for a way to get the same or similar functionality as the Nokia PC Suite on Ubuntu 10.04. I did find a discussion here [url].

However it is fairly old (2008). I was wondering if it is possible to get more recent information.

In the Ubuntu Software Center I find two applications that seem to fit the bill. I need to know which is better or are the complimentary.

View 3 Replies View Related

Programming :: Substitute Every Occurrence Of "( S" To "(S" In File

Mar 11, 2011

I want to substitute every occurance of "( S" to "(S" in my file (the quotes aren't included in my file. Its just there to specify what my pattern is)

This is my attempt to do it and the error message I get.

Code:
denish@ubuntu:~/Desktop/tgrep files$ sed 's/^( (S$/(S/g' test > test2
sed: -e expression #1, char 16: Unmatched ( or (

The "( )" has a different purpose in sed. So how exactly do I specify a ( in sed as a pattern and not as the special function?

View 7 Replies View Related

General :: Vim: Substitute For Page Up And Page Down Keys?

Aug 11, 2011

Vim: substitute for Page Up and Page Down keys?

View 4 Replies View Related

Ubuntu Servers :: Looking For A IIS Substitute?

Jan 31, 2011

I am setting up an ubuntu server, and i was wondering if there was a program that i could apt-get that would manage my Domain names and create directories and FTP and all that good stuff like IIS does in windows. While i am fully capable of editing the files and working the server through the terminal, noone else in my office is and if we are to switch to a linux server they will need to be able to work it.

View 9 Replies View Related







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