08-10-2010
Find replace a particular string of data with wildcard
Hi
I am having a csv file in which lots of data are available wherein i need to find a particular kind of data and replace it with null value.
here is the sample data..
Quote:
404-064-3204-204-10723 404-64-401-2081 404-064-3204-204-10721 404-064-3204-204-10653 404-064-3204-204-10652 404-064-3204-204-10651 404-64-401-2082 404-64-401-2251 404-64-401-2253 404-64-401-2093 404-64-401-2083
I need to find the string starting with 404-064- and up to the first space i have to remove the data and keep the remaining data as it is.
i.e the result expected is
Quote:
404-64-401-2081 404-64-401-2082 404-64-401-2251 404-64-401-2253 404-64-401-2093 404-64-401-2083
how to achieve this?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days...
The structure of the paths are like this:
/home/domains/www.domain2.com/tgp/
/home/domains/www.domain3.com/tgp/... (1 Reply)
Discussion started by: Neko
1 Replies
2. Programming
hi
I wanted to find this char " ^M " in my file and replace it with blank space.
I am using Unix system.
If i give command " :%s/^M//gc " it wont work
so can anyone tell what is command to find and replace
thankx (3 Replies)
Discussion started by: mridula
3 Replies
3. UNIX for Dummies Questions & Answers
Hi all,
My problem is the following:
I've a script that must list all files in a directory and write this information in a text file.
I've tried to get the list through ls command and then write it using msgecho
msgecho "`ls $PATH_APS_JOB_ORA`"
This works good but the created string... (7 Replies)
Discussion started by: callimaco0082
7 Replies
4. Shell Programming and Scripting
Hi,
I have a file named "Test_2008_01_21"
The file contains a string "manual" that occurs many times in the file
How can i find the positions of the string "manual" in the file
Ex: if the string " manual " occurs three times in the file. i want to replace the second occurance of string... (6 Replies)
Discussion started by: bab123
6 Replies
5. Shell Programming and Scripting
Hi,
Here is what I want to do
I want to search local directory and its sub directory, all the files which contain any string like _12345, then remove this string.
String is a combination of _ plus a random integer number.
For example, here is one line in a file before
<properties... (1 Reply)
Discussion started by: bp5000
1 Replies
6. Shell Programming and Scripting
Dear all,
I need your help, I have file like this:
file1:23456
01910964830098775635
34567
01942809546554654323
67589
26546854368698023653
09778
58716868568576876878
08675
86178546154065406546
08573
54165843543054354305
.
.file2:
23456 25
34567 26
67589 27 (2 Replies)
Discussion started by: attila
2 Replies
7. Shell Programming and Scripting
Hi,
Here's my dilemma.
I need to replace the string Sept_2012 to Oct_2012 in all *config.py files within the current directory and below directories
Is this possible?
Also I am trying to find all instances of the string Sept_2012 within files in the current directory and below
I have... (13 Replies)
Discussion started by: pure_jax
13 Replies
8. Solaris
Dear All
I need to find and replace a string in a set of files. I try as :
#find / -name "*"|xargs grep "Tektra"|grep -v "Tektra GSM BTS"
But it doesn't work. It just finds the string in the files. I need to find and replace it.Can you please let me know how to correct it?
Thank you (2 Replies)
Discussion started by: hadimotamedi
2 Replies
9. UNIX for Beginners Questions & Answers
HI there,
I am trying to find and replace with wildcard with
data
chr1 69511 69511 A G 1/1:0,34:791,78,0:78:34 0/1:55,60:1130,0,1513:99:116 1/1:0,28:630,63,0:63:28 0/1:0,34:626,57,0:57:34
To this
chr1 69511 69511 A G homo hetero homo hetero
Where I find and replace 0/1 with... (3 Replies)
Discussion started by: daashti
3 Replies
10. Shell Programming and Scripting
Hi,
I know how to replace a string with another in a file.
But, i wish to replace the below string pattern
EncryptedPassword="{gafgfa}]\asffafsf312a" i.e EncryptedPassword="<any random string>"
To
EncryptedPassword=""
i.e remove the random password to a empty string.
Can you... (3 Replies)
Discussion started by: mohtashims
3 Replies
LEARN ABOUT DEBIAN
ns_connreturnnotimplemented
Ns_ConnReturnStatus(3aolserver) AOLserver Library Procedures Ns_ConnReturnStatus(3aolserver)
__________________________________________________________________________________________________________________________________________________
NAME
Ns_ConnReturnBadRequest, Ns_ConnReturnForbidden, Ns_ConnReturnInternalError, Ns_ConnReturnNoResponse, Ns_ConnReturnNotFound, Ns_ConnReturn-
NotImplemented, Ns_ConnReturnNotModified, Ns_ConnReturnOk, Ns_ConnReturnStatus, Ns_ConnReturnUnauthorized, Ns_RegisterRedirect - Routines
to return simple standard responses
SYNOPSIS
#include "ns.h"
int
Ns_ConnReturnBadRequest(conn, msg)
int
Ns_ConnReturnForbidden(conn)
int
Ns_ConnReturnInternalError(conn)
int
Ns_ConnReturnNoResponse(conn)
int
Ns_ConnReturnNotFound(conn)
int
Ns_ConnReturnNotImplemented(conn)
int
Ns_ConnReturnNotModified(conn)
int
Ns_ConnReturnOk(conn)
int
Ns_ConnReturnStatus(conn, status)
int
Ns_ConnReturnUnauthorized(conn)
void
Ns_RegisterRedirect(server, status, url)
ARGUMENTS
Ns_Conn conn (in) Pointer to open connection.
char *msg (in) String with additional message text.
int status (in) Integer HTTP status code.
char *url (in) String which specifies internal redirection url.
char *server(in) Virtual server.
_________________________________________________________________
DESCRIPTION
These routines are used to generate complete responses, including headers, approriate status codes, content types, and possibly short HTML
content messages for the most common HTTP error or status responses. They each coorespond to a particular HTTP status code, for example,
Ns_ConnReturnNotFound generates an HTTP 404 "Not Found" response. They all return NS_OK if the response was sent or NS_ERROR if an under-
lying routine failed.
The default behavior is to return an internal, server generated response possibly with a short English language message, for example "The
requested URL cannot be accessed by this server". This behavior can be modified by calling the Ns_RegisterRedirect to redirect responses
internally for the cooresponding HTTP status code to another URL on the server. The "redirects" server config section can be used to map
these redirects at startup
int Ns_ConnReturnBadRequest(conn, msg)
Returns an HTTP 400 response with the short HTML message "Invalid Request: The HTTP request presented by your browser is invalid."
The optional msg string, if present, is also included in the message body.
int Ns_ConnReturnForbidden(conn)
Returns an HTTP 403 response with the short HTML message "Forbidden: The requested URL cannot be accessed by this server."
int Ns_ConnReturnInternalError(conn)
Returns an HTTP 500 response with the short HTML message "Server Error: The requested URL cannot be accessed due to a system error
on this server."
int Ns_ConnReturnNoResponse(conn)
Equivalent to Ns_ConnReturnStatus(conn, 204).
int Ns_ConnReturnNotFound(conn)
Returns an HTTP 404 response with the short HTML message "Not Found: The requested URL was not found on this server."
int Ns_ConnReturnNotImplemented(conn)
Returns an HTTP 404 response with the short HTML message "Not Implemented: The requested URL or method is not implemented by this
server."
int Ns_ConnReturnNotModified(conn)
Equivalent to Ns_ConnReturnStatus(conn, 304).
int Ns_ConnReturnOk(conn)
Equivalent to Ns_ConnReturnStatus(conn, 200).
int Ns_ConnReturnStatus(conn, status)
Generates a response with the given HTTP status with no content.
int Ns_ConnReturnUnauthorized(conn)
Returns an HTTP 401 response with the short HTML message "Access Denied: The requested URL cannot be accessed because a valid user-
name and password are required." As "WWW-Authenticate: Basic realm=server realm" header is also included in the response.
void Ns_RegisterRedirect(server, status, url)
Redirect the above responses from the given server for the given status code from the simple internal messages described above to
the given internal url. The redirect is performed using Ns_ConnRedirect.
SEE ALSO
Ns_ConnFlush(3), Ns_ConnRedirect(3), Ns_ConnSetRequiredHeaders(3), Ns_ConnQueueHeaders(3), ns_return(n)
KEYWORDS
connnection, response
AOLserver 4.0 Ns_ConnReturnStatus(3aolserver)