Sed, how replace specific symbols between two patterns
I have a big xmltv file with many lines like:
I don't know why my webserver reject some names of png files, so I am trying to rename it.
I am trying to use the command sed but I am really bad about.
I want replace the spaces, the symbol +, the symbol ? and others with underscore _
I tought to use like a pattern the strings dsgbnjfdc65657/ and .png and modify the spaces, the symbol + and ? between, but I had back only errors...
I tried also with xmlstarlet to replace "spaces" with "_" but also I had only errors
I really prefer if I can use sed
Can someone help me?
Last edited by Scrutinizer; 03-29-2018 at 03:40 PM..
Reason: quote tags -> code tags
Hi all,
I need your help.
For example I have string in file.txt:
-x -a /tmp/dbarchive_NSS_20081204 -f 900 -l 1 2008/12/04 2008/12/04
So, I need to replace symbols from (for e.g.) position 26 till 33 with symbols which I have in file replace.txt
And I have no idea how to do it.
If... (1 Reply)
using sed to replace a specific string on a specific line number using variables
this is where i am at
grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean
grep -n Destination... (2 Replies)
I am trying to use sed to replace specific characters at a specific position in the file with a different value... can this be done?
Example:
File:
A0199999123
A0199999124
A0199999125
Need to replace 99999 in positions 3-7 with 88888.
Any help is appreciated. (5 Replies)
My script is extracting data from SQl session, however sometimes the result contains one or multiple space after/before any numerical value.
e,g .
"123","1 34","1 3 45", "43 5"
How to remove these unwanted spaces..so that I can get the following result :
"123","134",1345","435" (1 Reply)
I'm drawing a blank on how to use sed to replace selectively based on position in the string (vs nth occurence):
hello.|there.|how.|are.|you.|
I want the period removed in the 3rd item (as defined by the pipe delimiter) if a period is present. So the result in this case would be:
... (2 Replies)
I asked this before, but my problem got more complicated. Heres what I am trying to do:
I'm trying to replace a string at a certain location with another string.
Heres the file I'm trying to change:
\E
I want to replace the escape code at the 3rd line, 2nd column with this escape code... (3 Replies)
I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work.
Brief overview:
I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Hi,
I would like to use sed to replace NA to x ('s/NA/x/g'), but only in the 5th column of the space delimited text file, nowhere else. How do I go about doing that? Thanks! (1 Reply)
I'm try to change a the prohibit to aix for the lines starting with ssh and emagent and rest should be the same. Can anyone please suggest me how to do that using a shell script or sed
passwd account required /usr/lib/security/pam_prohibit
passwd session required ... (13 Replies)
Hi,
Im using sed on an AIX machine. I am trying to change the 137-139 characters if they are a ' 36'/'000' to a '036'. The positions that need to be changed are fixed.
the source data that I have is$cat v.txt
4000422985400050462239065593606500000007422985707771046154054910075641MC0318AMWAY... (9 Replies)
Discussion started by: dsid
9 Replies
LEARN ABOUT OPENDARWIN
tcl_setstdchannel
Tcl_GetStdChannel(3) Tcl Library Procedures Tcl_GetStdChannel(3)__________________________________________________________________________________________________________________________________________________NAME
Tcl_GetStdChannel, Tcl_SetStdChannel - procedures for retrieving and replacing the standard channels
SYNOPSIS
#include <tcl.h>
Tcl_Channel
Tcl_GetStdChannel(type)
Tcl_SetStdChannel(channel, type)
ARGUMENTS
int type (in) The identifier for the standard channel to retrieve or modify. Must be one of TCL_STDIN, TCL_STDOUT, or
TCL_STDERR.
Tcl_Channel channel (in) The channel to use as the new value for the specified standard channel.
_________________________________________________________________DESCRIPTION
Tcl defines three special channels that are used by various I/O related commands if no other channels are specified. The standard input
channel has a channel name of stdin and is used by read and gets. The standard output channel is named stdout and is used by puts. The
standard error channel is named stderr and is used for reporting errors. In addition, the standard channels are inherited by any child
processes created using exec or open in the absence of any other redirections.
The standard channels are actually aliases for other normal channels. The current channel associated with a standard channel can be
retrieved by calling Tcl_GetStdChannel with one of TCL_STDIN, TCL_STDOUT, or TCL_STDERR as the type. The return value will be a valid
channel, or NULL.
A new channel can be set for the standard channel specified by type by calling Tcl_SetStdChannel with a new channel or NULL in the channel
argument. If the specified channel is closed by a later call to Tcl_Close, then the corresponding standard channel will automatically be
set to NULL.
If Tcl_GetStdChannel is called before Tcl_SetStdChannel, Tcl will construct a new channel to wrap the appropriate platform-specific stan-
dard file handle. If Tcl_SetStdChannel is called before Tcl_GetStdChannel, then the default channel will not be created.
If one of the standard channels is set to NULL, either by calling Tcl_SetStdChannel with a NULL channel argument, or by calling Tcl_Close
on the channel, then the next call to Tcl_CreateChannel will automatically set the standard channel with the newly created channel. If
more than one standard channel is NULL, then the standard channels will be assigned starting with standard input, followed by standard out-
put, with standard error being last.
See Tcl_StandardChannels for a general treatise about standard channels and the behaviour of the Tcl library with regard to them.
SEE ALSO Tcl_Close(3), Tcl_CreateChannel(3), Tcl_Main(3), tclsh(1)KEYWORDS
standard channel, standard input, standard output, standard error
Tcl 7.5 Tcl_GetStdChannel(3)