Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Replace characters after match Post 303036762 by spacegoose on Wednesday 10th of July 2019 04:10:42 PM
Old 07-10-2019
Replace characters after match

I have a file with lines like:

Code:
foo find "https://localhost" "/website/foo" "this/that/the/other" "yes/no/maybe" -u admin -p admin > yes/no/maybe.txt

I'd like to replace the slashes in the last column with hyphens, like this:

Code:
foo find "https://localhost" "/website/foo" "this/that/the/other" "yes/no/maybe" -u admin -p admin > yes-no-maybe.txt

without affecting the other columns where I have slashes.

Last edited by RavinderSingh13; 07-11-2019 at 12:51 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular Expression to match repeated characters

Hello All I have file which contain sample data like below - test.txt ---------------------------------------------- jambesh aaa india trxxx sdasd mentor asss light train bbblah --------------------------------------------- I want to write a regX which would print only those... (4 Replies)
Discussion started by: jambesh
4 Replies

2. Shell Programming and Scripting

How to replace characters with random characters

I've got a file (numbers.txt) filled with numbers and I want to replace each one of those numbers with a new random number between 0 and 9. This is my script so far: #!/bin/bash rand=$(($RANDOM % 9)) sed -i s//$rand/g numbers.txtThe problem that I have is that it replaces each number with just... (2 Replies)
Discussion started by: hellocatfood
2 Replies

3. Shell Programming and Scripting

search pattern and replace x-y characters in nth line after every match

Hi, I am looking for any script which can do the following. have to read a pattern from fileA and copy it to fileB. fileA: ... ... Header ... ... ..p1 ... ... fileB: .... .... Header (3 Replies)
Discussion started by: anilvk
3 Replies

4. Shell Programming and Scripting

Replace special characters with Escape characters?

i need to replace the any special characters with escape characters like below. test!=123-> test\!\=123 !@#$%^&*()-= to be replaced by \!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies

5. Shell Programming and Scripting

Find out match characters on all lines

I have a file with 22 lines. Each line has only 5 different chars, no white space, and each line is 3,278,824 in length. The 5 chars is "-", "A", "B", "C", "D". Below is an example of the first 25 chars of the first four lines of the file. -----ABCDA--CD-BBBBB----D --A--ABCD--DCD-BBBBC-----... (12 Replies)
Discussion started by: cwzkevin
12 Replies

6. UNIX for Dummies Questions & Answers

Display/Cut the characters based on match

I have input file like this update tablename set column1='ABC',column2='BBC' where columnx=1 and columny=100 and columnz='10000001' update tablename set column1='ABC',column2='BBC',column3='CBC' where columnx=1 and columny=100 and columnz='10000002' update tablename set column1='ABC' where... (1 Reply)
Discussion started by: nsuresh316
1 Replies

7. Shell Programming and Scripting

How to extract next n characters after a match is found?

Hi, I want to extract the next 7 characters after I encounter the first ( in the code eg abc123=(xvn1342) xyz678123=(ret8901) I want to extract xvn1342,ret8901. Please advise how to achieve this with awk, if possible? (9 Replies)
Discussion started by: sidnow
9 Replies

8. Shell Programming and Scripting

Rearrange or replace only the second line after pattern match or pattern match

Im using the command below , but thats not the output that i want. it only prints the odd and even numbers. awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}' Im hoping for something like this file1: Text hi this is just a test text1 text2 text3 text4 text5 text6 Text hi... (2 Replies)
Discussion started by: invinzin21
2 Replies

9. Shell Programming and Scripting

awk match shell variable that contains special characters?

How to match a shell variable that contains parenthesis (and other special characters like "!") file.txt contains: Charles Dickens Matthew Lewis (writer) name="Matthew Lewis (writer)"; awk -v na="$name" ' $0 ~ na' file.txt Ideally this would match $name in file.txt (in this... (3 Replies)
Discussion started by: Mid Ocean
3 Replies

10. UNIX for Beginners Questions & Answers

Inserting n characters to beginning of line if match

I would like to insert n number of characters at the beginning of each line that starts with a given character. If possible, I would be most appreciative for a sed or awk solution. Given the data below, I would like to be able to insert either 125 spaces or 125 "-" at the beginning of every line... (6 Replies)
Discussion started by: jvoot
6 Replies
asadmin-add-admin-object(1AS)					   User Commands				     asadmin-add-admin-object(1AS)

NAME
add-admin-object - adds the administered object with the specified JNDI name SYNOPSIS
add-admin-object --user admin_user[--password admin_password] [ --host localhost] [--port 4848] [--passwordfile filename] [ --secure|-s] --aorestype admin_object_type [--property name=value[:name=value]*] --raname rar_filename jndi_name Creates an administered object corresponding to a resource adapter. The ra.xml file can be found in the META-INF directory of the resource adapter archive. After a .RAR file is deployed to the application server, it gets extracted and a directory corresponding to the .RAR name is created under $INSTANCE_ROOT/applicaitons/j2ee-modules (or j2ee-apps). You can find the ra.xml in the META-INF subdirectory of the RAR's directory. OPTIONS
--user administrative user associated for the instance. --password administrative password corresponding to the administrative user. --host host name of the machine hosting the administrative instance. --port administrative port number associated with the administrative host. --secure indicates communication with the administrative instance in secured mode. --passwordfile file containing passwords appropriate for the command (e.g., administrative instance). --aorestype administered object resource type as defined by the resource adapter in the ra.xml file. --property optional attributes name/value pairs for configuring the resource. --raname name of the resource adapter. OPERANDS
jndi_name JNDI name of the administered object to be added. Example 1: Using add-admin-object A JMS queue, called sample_jmsqueue, is assumed to have already been created using the create-jmsdest command. asadmin> add-admin-object --user admin --password adminadmin --aorestype javax.jms.Queue --property Name=sample_jmsqueue --raname jmsra jms/samplequeue Created the object EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-delete-admin-object(1AS), asadmin-list-admin-objects(1AS) J2EE 1.4 SDK March 2004 asadmin-add-admin-object(1AS)
All times are GMT -4. The time now is 07:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy