Programming :: Replace A Certain Range Of Characters In Unix?

Mar 8, 2010

I have a hard time figuring this out. I need to replace the date formats of arrival date(column 31-40) and departure date(column 42-51) and I need 2 outputs. I cannot even figure out how to start.code...

View 6 Replies


ADVERTISEMENT

Programming :: Javascript Many Characters As Reg Expression Replace?

Jan 2, 2010

I'm working with javascript and trying to replace all instances of a Roman character in a string with nothing. How do I assign var reg to all Roman characters? In UTF8, capital letter A is U0041 and at the other end, small z is UFF5A.

So, I'd like to do something like:
var reg = u0041 - UFF5A;
str1 = str.replace(reg, '');

I think you get the idea. I have no idea if that can be done. The idea is to take this string (for example): str = make a door-to-door[house-to-house] visit / ring every doorbell." And take out all the Roman characters and define it as str1. And then take out all the Korean characters (u1100-uFFDC) and define it as str2. In fact, a WAY more useful thing to do would be to replace the instance of this: [u1100-uFFDC]+" "+[u0041-UFF5A] with [u1100-uFFDC]+","+[u0041-UFF5A] so that the output would be a .csv file.

View 5 Replies View Related

Programming :: Bash Script To Ping A Range Or Own IP-range?

Apr 11, 2011

I want to build a bash script, which can ping a range IP adresses which will be filled in by the admin. If there is no IP-adress filled in, then the script must ping the subnet where the system is logged on. So if my ip is 192.168.1.6, then the script must ping from 192.168.1.1 till 192.168.1.255 Or else, if there is given a beginning and ending ip it must ping that!

The first part of the bash script is to ping a given range (see below). But there is one problem, how can I tell the script to ping from $begin till $end, [..] is of course wrong! But what must be filled in there???

echo "Enter beginning IP-adres:"
read begin
echo "Enter ending IP-adres:"
read end
ping -c 1 $begin [..] $end

The second part is to find my own ip and ping the whole range.. How to do that? I only can find my own IP, but I cant ping the whole range,, how to do that?

#!/bin/bash
ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' |
cut -d: -f2 | awk '{ print $1 }'

View 11 Replies View Related

General :: Replace Characters In Txt File?

Nov 7, 2010

I have txt file with list of ID's and I need to insert comma in every line and then remove new line character so it'll become one long string. So to clarify, I have txt file content that looks like this.

234
5466
2356
... and so on.

but I would like this to change to 234,5466,2356,... I looked at sed and tried to wrap my head around the commands but I guess my brain isn't smart enough. its really confusing for me. I've managed to add commas to end of line (sed "s/$/,/g" filename) but somehow I can't seem to remove new line character from each line.

sed 's/[

]*$//' doesn't seem to work.

View 4 Replies View Related

Ubuntu :: Replace Strings Containing Special Characters With Sed?

Jan 4, 2011

here's my newbie question - I want to change the following string in text files

Code:
E:MP3
with the following string using sed:

[code]....

View 3 Replies View Related

Software :: Using Sed To Replace Special Characters In A File?

Mar 24, 2011

I have a file with special characters that need to be replaced. I've been working on this for a day and have run out of time.

Example: FILE='/var/tmp/S0000000.LOG.March-24-2011:10:51.tar'

Need to replace the ' with a " on all lines in the file.

View 2 Replies View Related

General :: Using Sed To Replace String With Special Characters In XML File?

Apr 29, 2011

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

View 2 Replies View Related

Ubuntu :: Script To Replace Characters In Text File?

Jun 30, 2011

I have an odd request, lets say I have a text file like this:

Quote:

Code:

__##___##___IIIIII
__##___##_____II__
__##___##_____II__
__#######_____II__
__##___##_____II__
__##___##_____II__
__##___##___IIIIII

I want a script that will replace all of the hash tabs with random characters.I found this command will generate a random character

Quote:

apg -a1 -n1 -m1 -x1 -d

how to script a search and replace using that random character upon each successive find until the end of file occurs.

View 9 Replies View Related

General :: Replace New Line With <br /> And Escape Special Characters?

Feb 6, 2011

I wish to replace a new line with br (html) but it doesn't seem to work

Code:

message=$(echo ${FORM_message} | tr '
' '<br />' )

what it gives me seems to be ... b...? I am also having problem escaping hash sign in cut command:

Code:

list=$(echo "$line" | cut -d'#;#' -f1) ;

my intention is to split the line with "#;#"

View 5 Replies View Related

General :: Search And Replace String Having Multiple Special Characters

Aug 26, 2009

Below is extract of my file:

What I need is to replace "--destination-path=" with "--destination-path=/home/dest"

i.e. desired output is ----destination-path=/home/dest

I could achieve it with below command

$cat outgoing-xfer|grep destination-path|perl -pi -e "s/destination-path=/destination-path=/home/dest/g"

But the problem is that in this case i just wanted to append "/home/dest" for which I could easily escape "/" with just two "", but I wonder if i have a long path like "/a/b/c/d/e/f/g/h/i/j" I will have to escape so many /. Is there any other way by which I can avoid escaping forward slash.

I tried following:

But receiving follo error

Bareword found where operator expected at -e line 1, near "s/destination-path=/'destination-path=/home"
syntax error at -e line 1, near "s/destination-path=/'destination-path=/home"
Bad name after dest' at -e line 1. tried with enclosing in double quotes as well but in vain

View 5 Replies View Related

Programming :: Unix Programming - Single Thread Server Can Support Exactly 2 Clients At Once

Sep 28, 2010

A simple TCP based chat server could allow users to use any TCP client (telnet, for example) to communicate with each other. For this question you should consider a single process, single thread server that can support exactly 2 clients at once, the server simply forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages as soon as something is sent from one client it is immediately forwarded to the other client. As soon as either client terminates the connection the server can exit

View 4 Replies View Related

Programming :: Unix Programming - Single Process That Does Not Start Up Any Other Threads

Sep 28, 2010

i want a process that can operate as both a TCP echo server and a UDP echo server. The process can provide service to many clients at the same time, but involves a single process that does not start up any other threads.

View 3 Replies View Related

Programming :: C Program In Unix Environment?

Jan 12, 2011

my instructor gave me a project in c programming language, the probelem i don't have a c program combiler and i don't have a unix os on my computer, and my knowledge in c program is soo weak i took it years ago, i have this code but it does't compile on Dev-C++ on Windows OS, so if you just help me out with this program:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

[code]....

View 5 Replies View Related

Programming :: How To Read A String And Add It At The End In Unix

Jun 9, 2010

I want to read the line in the text file and get the string in the file and paste it in the directory column

for example i have a line like /ftp/prod/SWC1407.DOC

from this 1407 should be parsed and appended at the end of the move command

mv /ftp/prod/SWC1407.DOC /nfp/1407

View 7 Replies View Related

Programming :: How To Write Own Shell In Unix

Sep 16, 2010

I wish to create my own shell for my operating systems project in college...

My professor has asked me to make sure that my shell can execute at least 30 or 40 commands... I have around a month's time

I have seen endless source codes in the net, I'm not able to understand any of it

How do i get about doing it?

View 2 Replies View Related

Programming :: Simulate Unix Kernel In C++ ?

Jun 2, 2010

How simulate unix kernel in c++..or give me a link....

View 2 Replies View Related

Programming :: Unix Process Id In Jdk1.4.2?

Mar 2, 2009

what is the best/accurate way to get the process id in java code in order to write to the log file. To be specific: I am using avalon logkit for logging. I really cannot find a way to write the process id to each line in the log.

View 1 Replies View Related

Programming :: Out Of Range Vector Iterator?

Mar 20, 2011

I'm not really a C++ noob at all, but I am a little rusty at the moment. Still, I CANNOT figure out what is wrong with the following code. I'm using Visual Studio 2010.

Code: #include <iostream>
#include <fstream>
#include <vector>
#include <string>

[Code]....

I THINK I got all of the pertinent code. Anyway, it fails at the *** line. I CANNOT figure out why. If I modify it to be linein.size()-30, it STILL gives me an error. That makes zero sense.

View 3 Replies View Related

Programming :: How To Tell Java To Print 20 When Value Is In That Range

Jul 28, 2011

I've just started programming at my university and I'm finding it a bit hard to get started. I've been given this for homework.Given 2 integers, a and b, print their sum. However, sums in the range 10..19 inclusive, are forbidden, so in that case just print 20The problem I'm having is that i don't know how to tell java to print 20 when the value is in that range.

View 14 Replies View Related

Networking :: What Are Short Range Link And Long Range Links In Routing

Jun 23, 2009

get me understand the short range and the long range links from routing (and routing protocols') point of view.

View 6 Replies View Related

Software :: Gnuplot - Combining A Linear Range And Log-scale Range In The Same X-axis?

Apr 24, 2011

I want to plot a set of data in only one plot.The problem is that some points of the data should be better plotted in a linear scale (lets say 0 to 100,000) but there are other data points that, exceding the value 100,000, would be better plotted in a logarithmic scale, as they goes in the range 100,000 to 500,000,000. Let's say the data is:

Code:

X Y
0 100
10000 80
20000 75

[code]....

Is there a way to plot all these points in the same plot in only one X-axis showing two different ranges in that axis: linear: 0-100,000 logarithmic: 100,000 - 1,000,000,000?The axis would be read, for example, as:

Code:
|-----|-----|-----|-----|-----|-----|-----|-----|-----|
0 20k 40k 60k 80k 100k 1M 10M 100M 1G

(The abbreviations k-M-G are not the important point. Just shown for clarity)

View 2 Replies View Related

General :: Unix Platforms And Programming Paradigms?

Oct 31, 2010

There are C, C++, Java, Perl, Python, PHP, and some other programming orand scripting languages for a Unix / Linux Distro. On a scale of 1 - 10, I rate myself on:

5 for C / C++
5 for Java
7 for PHP
2 for Perl

When I look for a Unix job I am often asked if I know C / C++, Perl or Java. Well, they mostly look for C / C++ + Unix or Perl / Python + Unix or Java + Unix combinations. That is the trend here in India. When they advertise for C / C++ + Unix they also mean Real Time System, Kernel (Modules), and Device Drivers Development. I don't know how to do those things in C / C++. But I must say that I love C / C++ and anything else no matter how attractive or easy it could be doesn't look that much challenging to me. So, which should I take now to add to my skills set and be more productive in terms of System Administration and Application Development and Support?

In C/C++ and Java, though I know them, I don't get to work in my current job. However, I often use Shell Script (Bash) and PHP and so I am finding Perl easy because the basics of Computer Programming that I learnt by learning C and C++ and Java have made it easy for me to understand any programming language.

View 2 Replies View Related

Programming :: Transfer C Codes From UNIX To System?

Jun 16, 2010

I got some problems and need your help.

In school, my codes are writeen under UNIX system (Solaris10/SUN), now I need to transfer those codes to Linux (Redhat5). But after I directly copy to Linux, it shows many errors and warnings.

Does anyone know which codes I need to modify to specifily suit for UNIX? I am not familiar with those systems and hope to get your kind help.

View 5 Replies View Related

Programming :: Unix Script For Oracle Database?

Apr 7, 2011

creating the below unix script to run in oracle database .I need a script which should do the following things.

1. The script should insert row count of a table from one database(A) into table (AB) in another database(B).

2. The script should update tow count of the similar table and tablespace from database (B) in to a table AB.

3. The script should update the status column of the table AB as: 'Y' if the rowcount of the table@A and rowcount of the table@B matching. or else it should update 'N'

View 4 Replies View Related

Programming :: Delete A Specific Range Of Files?

Aug 13, 2010

I have 50 files in the following format.

fileone.0001.txt
filetwo.0002.txt
filethree.0003.txt

[code]...

View 4 Replies View Related

Programming :: Sed Print Range From Pattern1 To Pattern2?

Jun 14, 2011

From a file I want to extract a range of lines by patterns. I've used variations on

Code:
sed -n -e '/^BashNotes/,/^EndOf[A-Za-z]*$/ p' -e '/^EndOf[A-Za-z]*$/ q' Notes

So, I want to extract lines starting from one whose first word is specified, in this case "BashNotes", and ending at the first line consisting of the single word "EndOf...", which in this case would be "EndOfBashNotes".

Either I get no output at all, or it prints from the start of file to the first EndOf..., so the problem has to be with "^BashNotes", e.g. remove the "^" and it accesses an earlier occurrence of "BashNotes" that is in the middle of the first line of the file, and prints to the first occurrence of "EndOf...".

So why should a "^" in the "from" pattern be objectionable, when it is acceptable in the "to" pattern and the "quit" statement?

View 7 Replies View Related

Programming :: Shell: Give A Range Argument To 'for'

Feb 20, 2010

Feel free to just link to another thread where this is (pre)solved; I can't search the forum for the word "for," because it's too short (or maybe the search engine dislikes prepositions).

Is there a way to give the 'for' command a range? Here's what I mean:

Code:
#for i in (1-5); do echo $i; done
Certainly, meat space user; I understand exactly what you're thinking.
1
2
3
4
5
True, I realize I could use

Code:
COUNT=1 ; while [ $COUNT -lt 6 ]...

...but if I can avoid the extra preparatory step I'd prefer to do so.

View 2 Replies View Related

Programming :: Connect To Remote Unix Server Using Script?

Aug 4, 2010

1)We need to do a clean up a folder in a remote unix server . What is the best option to connect to remote server? how do we use ssh ? Is there any prerequisite to use ssh?

2) We have to SCP few files to another folder in a remote unix server . I formed the below command to use in script. Is it of correct usage? scp -r $POS_HOME/posctl [login nameip address:/home/username/directory]

I have seen public key/private key generation part for SCP. How do we handle this? Does this need to be done as unix admin?

View 7 Replies View Related

Programming :: Batch File To Run Unix Commands From Windows?

Nov 22, 2010

I need to write a windows batch file to run unix commands by logging onto a telnet unix server. For example , I might want the batch file to log onto the unix sever, run the ls command, collect the output in a file and ftp it back to my windows desktop

View 8 Replies View Related

Programming :: Getting Error In Ftp From Windows To Unix Box - Permission Denied

Mar 18, 2009

I have a written a java code to ftp a file from the windows box to unix box. It keeps giving me the following error : "java.io.FileNotFoundException: PORT 204,63,56,5,16,78: 550 Permission denied." I am able to ftp manually from windows to unix.

View 5 Replies View Related







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