I have a text file and every line ends in
|^
|^^
|^^^
|^^^^
I need to use sed to make all lines end it
|^
regardless of the amount of carrots.
The code i was using is:
cat FILE | sed 's/\^\^\^/\^/g'
But then they threw that curveball at me. Also is there a way to... (2 Replies)
Hi All,
I don't know what I am doing wrong in the regex below.
I have the following string:
31000000010201005181121360000000100000000003000000YYY-YYY-YYY-20100518-104139.txt.YYY
I need to split it in parts:
- Group 1: 3100000001020100518112136
- Group 2: 000000010
- Group 3:... (0 Replies)
cat input.txt
agsbdafgd
ertebrtreter
ahrbrwerg
The last character of a line that does not start with a would be changed to Z.
Final output:
agsbdafgd
ertebrtreteZ
ahrbrwerg
Can anyone post the sed command to do that? (2 Replies)
Hi All,
Was wondering how I can do the following....
I have a String as follows
"ACCTRL000005022RRWDKKEEDKDD...."
This string can be in a file called tail.out or in a Variable called $VAR2
Now I have another variable called $VAR1="000004785" (9 bytes long), I need the content of... (5 Replies)
Hello.
I am using :
sed -i -e '/§name_script§/a#'"${MY_TAB11}"'# \
#'"${MY_TAB1}"'The Standard way'"${MY_TAB7}"'# \
#'"${MY_TAB1}"'==============='"${MY_TAB7}"'# \ ' "$CUR_FILE"
Is there a better way to define "MY_TAB7","MY_TAB11" in other way than :
MY_TAB1=$'\t'
MY_TAB2=${MY_TAB1}$'\t'... (2 Replies)
Hi,
I have a requirement to search for a pattern in each line in a file and remove the in between words till the 3rd occurrence of double quote (").
Ex: CREATE TABLE "SCHEMANAME"."AMS_LTV_STATUS"
(Note: "SCHEMANAME" may changes for different schemas. Its not a fixed value)
I need to... (2 Replies)
Hello All,
I have file named filelist.txt
a.bteq.ctl
b.bteq.ctl
c.bteq.ctl
I want to replace the word bteq to tpt in this file.
I used this sed command
cat filelist.txt | sed 's/bteq/tpt/g' > filelist.txt
But this command deletes all records from the filelist.txt
Can... (2 Replies)
Hi All,
I have a requirement to find and replace old date with new date value. Below is the scenario:
# In the input file, date is MM/DD/YYYY format
PREV_DTE=09/15/2013
I want to replace with 09/30/2013. It should look like
PREV_DTE=09/30/2013
I am using below sed command :... (4 Replies)
Hello to all,
I have the following text where columns are separated by spaces. I want to have the 3rd column separating
3 strings with 2 "_" in the format below:
LeftSring_CentralString_RightString
So, in 3rd column I want to replace all "_" with "-", except the first and last "_"
The... (5 Replies)
Discussion started by: Ophiuchus
5 Replies
LEARN ABOUT SUNOS
tr
tr(1B) SunOS/BSD Compatibility Package Commands tr(1B)NAME
tr - translate characters
SYNOPSIS
/usr/ucb/tr [-cds] [ string1 [string2]]
DESCRIPTION
The tr utility copies the standard input to the standard output with substitution or deletion of selected characters. The arguments string1
and string2 are considered sets of characters. Any input character found in string1 is mapped into the character in the corresponding posi-
tion within string2. When string2 is short, it is padded to the length of string1 by duplicating its last character.
In either string the notation:
a-b
denotes a range of characters from a to b in increasing ASCII order. The character , followed by 1, 2 or 3 octal digits stands for the
character whose ASCII code is given by those digits. As with the shell, the escape character , followed by any other character, escapes
any special meaning for that character.
OPTIONS
Any combination of the options -c, -d, or -s may be used:
-c Complement the set of characters in string1 with respect to the universe of characters whose ASCII codes are 01 through 0377
octal.
-d Delete all input characters in string1.
-s Squeeze all strings of repeated output characters that are in string2 to single characters.
EXAMPLES
Example 1: Creating a list of all the words in a filename
The following example creates a list of all the words in filename1, one per line, in filename2, where a word is taken to be a maximal
string of alphabetics. The second string is quoted to protect `' from the shell. 012 is the ASCII code for NEWLINE.
example% tr -cs A-Za-z '