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: 0000000003000000
- Group 4: YYY-YYY-YYY-20100518-104139.txt.YYY
Check below my sed regex execution:
Why it prints the whole string instead of printing only the groups I asked? What I am doing wrong?
Thanks a lot!
---------- Post updated at 04:21 PM ---------- Previous update was at 03:51 PM ----------
Ok! I am going to answer my own question! Hahah... Sorry!
After doing some tests and splitting my regex in parts I found that the problem was in the $ in the last group: (.*$).
I'm new with 'sed' and for sure something still I don't understand yet with it. If you see my output on ">Output..." portion, the new directory still on "source_dir" instead of "dest_dir". You may disregard for the "tar" part, this is just a test script, just for me to understand 'sed' using the... (3 Replies)
I have lines like:
table10 table_name_10 table10 table_name_10
table20 table_name_20 table20 table_name_20
table30 table_name_30 table30 table_name_30
I want to change the second "table_names" in all lines to test_table_name. Required output would be:
table10 table_name_10 table10... (19 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 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 experts, I'm looking for a unix solution to replacing "NA" within a matrix with the mean of the column:
$cat file
ID a b c d
day 10 5 100 50
cat 20 6 200 50
dog NA 8 NA 50
car 15 NA NA ... (3 Replies)
Dear All,
I am struggling with the following task and would appreciate some help. I have a large table (file1.txt). The first column of this table contains an ID. I would like to replace the ID with a label according to a reference file.
Here is an example:
cat infile.txt
0 AJ2312 310 ... (7 Replies)
Hi All,
I had a query related to sql select update replace command.
i have a table named clusters and it looks like this
name model characteristics
sample1.1 +123 parent
sample1.2 -456 clone
sample1.3 +122 ... (5 Replies)
Hi all ,
I have to write a shell script that takes a number as input , like 123
and the output will be 6 ,i.e the output will be the sum of digits of the input.
I have an idea as follows,
echo "123"|fold -1|tr '\n' '+'|bc
But the problem is after " echo "123"|fold -1|tr '\n' '+' "... (5 Replies)
Hello guys,
I'm trying to replace the word "i.e." for "ie." in Vi but everytime I used the search tool for start looking for it (this is: /i.e.), it finds every word that contains the "i" and "e" word. I tried the following command:
:%s/i.e./ie./g
However, it doesn't work.
Any help... (2 Replies)
I already have accomplished this task using sed and arrays, but since I get the variable using awk, I figured I'd ask this question and maybe I can get a cleaner solution using strictly awk.. I just can't quite grasp it in awk.
Story: I'm automating the (re)configuration of network interfaces,... (3 Replies)