Sponsored Content
Top Forums Shell Programming and Scripting Replacing space with hyphen in a pattern. Post 302980354 by shoaibjameel123 on Friday 26th of August 2016 09:41:00 AM
Old 08-26-2016
Thanks, and sorry for not being very clear in my initial post. The output that I am trying to get is:
Code:
'''Anarchism''' is a [[political-philosophy]] that advocates [[self-governance|self-governed]] societies with voluntary institutions.

Another example,
Code:
The first political philosopher to call himself an anarchist was [[Pierre-Joseph-Proudhon]], marking the formal birth of anarchism in the mid-nineteenth century.

Some noisy text:
Code:
[[Online-etymology-dictionary]].</ref> The first known use of this word was in 1539.<ref>"Origin of ANARCHY

Therefore, I only aim to replace space with a '-' within this pattern "[[ ]]" and no where else in the text file. The outputs that I get from the above two suggested solutions are putting hyphens everywhere.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Replacing URL in a file with space

Hi, I have a file with a URL text written in it within double quotes e.g. "http://abcd.xyz.com/mno/somefile.dtd" I want the above text to get replaced by a single space character. I tried cat File1.txt | sed -e 's/("http)*(dtd")/ /g' > File2.txt But it didnt work out. Can someone... (5 Replies)
Discussion started by: dsrookie
5 Replies

2. UNIX for Dummies Questions & Answers

replacing space with pipe(delimiter)

Hello All, I have a file with thousands of records: eg: |000222|123456987|||||||AARONSON| JOHN P|||PRIMARY |P |000111|567894521|||||||ATHENS| WILLIAM k|||AAAA|L Expected: |000222|123456987|||||||AARONSON| JOHN |P|||PRIMARY |P |000111|567894521|||||||ATHENS| WILLIAM |k|||AAAA|L I... (6 Replies)
Discussion started by: OSD
6 Replies

3. UNIX for Advanced & Expert Users

sed help on replacing space before and after *

I would like to replace the value of * (which might have one or more whitespace(s) before and after *) using sed command in aix. Eg: Var='Hi I am there * Desired output: Hi I am there* (1 Reply)
Discussion started by: techmoris
1 Replies

4. Shell Programming and Scripting

Replacing a string with a space

I'm trying to replace a string "99999999'" with the blank where ever is there in the file. Could you please help in unix scripting. Thank You. (6 Replies)
Discussion started by: vsairam
6 Replies

5. Shell Programming and Scripting

Replacing / with a space using awk

I have a string and want to replace the / with a space. For example having "SP/FS/RP" I want to get "SP FS RP" However I am having problems using gsub set phases = `echo $Aphases | awk '{gsub(///," ")}; {print}'` (5 Replies)
Discussion started by: kristinu
5 Replies

6. Shell Programming and Scripting

help - sed - insert space between string of form XxxAxxBcx, without replacing the pattern

If the string is of the pattern XxxXyzAbc... The expected out put from sed has to be Xxx Xyz Abc ... eg: if the string is QcfEfQfs, then the expected output is Qcf Ef Efs. If i try to substitute the pattern with space then the sed will replace the character or pattern with space,... (1 Reply)
Discussion started by: frozensmilz
1 Replies

7. Shell Programming and Scripting

Replacing a pattern in different cases in different columns with a single pattern

Hi All I am having pipe seperated inputs like Adam|PeteR|Josh|PEter Nick|Rave|Simon|Paul Steve|smith|PETER|Josh Andrew|Daniel|StAlin|peter Rick|PETer|ADam|RAVE i want to repleace all the occurrence of peter (in any case pattern PeteR,PEter,PETER,peter,PETer) with Peter so that output... (5 Replies)
Discussion started by: sudeep.id
5 Replies

8. Shell Programming and Scripting

Finding the pattern and replacing the pattern inside the file

i have little challenge, help me out.i have a file where i have a value declared and and i have to replace the value when called. for example i have the value for abc and ccc. now i have to substitute the value of value abc and ccc in the place of them. Input File: go to &abc=ddd; if... (16 Replies)
Discussion started by: saaisiva
16 Replies

9. Shell Programming and Scripting

sed - replacing a substring containing a hyphen

I'm attempting to replace a substring that contains a hyphen and not having much success, can anyone point out where i'm going wrong or suggest an alternative. # echo /var/lib/libvirt/images/vm888b-clone.qcow | sed -e 's|vm888-clone|qaz|g' /var/lib/libvirt/images/vm888b-clone.qcow (1 Reply)
Discussion started by: squrcles
1 Replies

10. Shell Programming and Scripting

Gawk --- produce the output in pattern space instead of END space

hi, I'm trying to calculate IP addresses and their respective calls to our apache Server. The standard format of the input is HOST IP DATE/TIME - - "GET/POST reuest" "User Agent" HOST IP DATE/TIME - - "GET/POST reuest" "User Agent" HOST IP DATE/TIME - - "GET/POST reuest" "User Agent" HOST... (2 Replies)
Discussion started by: busyboy
2 Replies
GSMARKUPBROWSER.APP(1)					      General Commands Manual					    GSMARKUPBROWSER.APP(1)

NAME
GSMarkupBrowser.app - GNUstep Development Framework SYNOPSIS
GSMarkupBrowser.app [FILE] DESCRIPTION
This manual page documents briefly the GSMarkupBrowser.app utility. This manual page was written for the Debian distribution (based on the program's README file) because the original program does not have a manual page. GSMarkupBrowser.app is a GNUstep Renaissance utility that allows a developer to review the look and feel of a GUI based on its GNUstep Renaissance Markup Language file (gsmarkup for short.) This allows the designer to develop the layout without having to actually have working code to run the program. Of course, the GUI is just for visual inspection -- it does not support any functional use of the application. Renaissance was written by Nicola Pero (n.pero@mi.flashnet.it) and is part of the GNUstep project (http://www.gnustep.org). GNUstep Renaissance home page is at http://www.gnustep.it/Renaissance. AUTHOR
This manual page was written by Brent A. Fulgham <bfulgham@debian.org>, for the Debian project (but may be used by others). SEE ALSO
GSMarkupLocalizableStrings.app(1), Renaissance(7) GNUstep February 6, 2004 GSMARKUPBROWSER.APP(1)
All times are GMT -4. The time now is 10:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy