Remove matching pattern on each line with number variations
Hello folks!
I have a file containing lines like this
I would like to replace everything from ( Remove This: 1,111 ) or whatever number pattern follows with a tab space so the output would be:
Thank you for your help!
Last edited by Scrutinizer; 02-16-2017 at 03:14 AM..
Reason: quote tags -> code tags
I have a few to questions pose in response first:-
Is this homework/assignment? There are specific forums for these.
What have you tried so far?
What output/errors do you get?
What OS and version are you using?
What are your preferred tools? (C, shell, perl, awk, etc.)
What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly, What have you tried so far?
There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.
We're all here to learn and getting the relevant information will help us all.
It's not a homework assignment. I'm just trying to clean up some data which i had extracted.
Basically i tried some commands with sed and awk but could not figure this out. I'm not a programmer so i don't know much about working my way around this I thought maybe someone here might have a solution for this hopefully.
Basically what i'm trying to accomplish is the following.
I have a data file which is about 40K lines long so it would take me forever to clean it up manually.
In my file i have data structured like this:
After "Same text:" the numbers are randomized from 1 to 50,000.
I would like to replace everything from "Same text: RANDOMIZED NUMBER" with a tab space so the output can be:
I'd appreciate any help for this if there is a way.
Hi Gurus,
I have a file as follows (Sample shown below but the list is very huge)
SCHEDULE WS1#JS1
RUNCYCLE1
:
WS1#JOB1
WS1#JOB2
FOLLOWS JOB1
END
SCHEDULE WS2#JS1
RUNCYCLE2
:
WS1#JOB3
WS1#JOB1
FOLLOWS JOB3
WS2#JOB1 (10 Replies)
Hi,
I want to remove the spaces from all the lines matching a particular pattern from my file. For instance in file abc.txt I have following data.
Header,This is the header
111,this is 1st record
222, this is 2nd record
333, this is 3rd record
Footer,3 records found
Footer,111222333 ... (5 Replies)
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Hi
I have assigned an output of a command to $I. I try to print the input and put a new line after occurrence of the hostname which is assigned to $HOST1 ( Example: pwrm16 ) . First of all I need to get rid of the Colon after the host name pwrm16: and make it pwrm16 then I want to print the... (10 Replies)
Hi,
I want to match the pattern in file1 with file2 and print the value in file2 and paste in file1
file1:
ISHO RT SR Major 96.46778
Drop Call Rate CS Critical 0.5072662
ISHO RT SR Major 97.754364... (3 Replies)
Hi,
I want to search a pattern in a text file and remove another pattern in that file.
my text file look like this
0.000000 1.970000 F 303 -
1.970000 2.080000 VH VH +
2.080000 2.250000 VH VH +
2.250000 2.330000 VH L -
2.330000 2.360000 F H +
2.360000 2.410000 L VL -
2.410000 ... (6 Replies)
Hi
I have written a shell script which used sed code below
sed -i 's/'"$Pattern"'/ /g' $FileName
I want to count the length of Pattern and replace it with equal number of spaces in the FileName.
I have used $(#pattern) to get the length but could not understand how to replace... (8 Replies)
I have the following code and want to get only the comments.
Ideally I would like to replace the characters to the left of the first '!' in the line with blanks.
real, dimension(:), allocatable :: ft ! stores a single trace
real, dimension(:), allocatable :: tr ! stores a single... (8 Replies)
I have a certain mnemonic string from which I want to calculate a number
The pattern follows three letters s, v and d. If a letter is by its own, the number assigned to the letter is assumed to be one. Else it takes the value preceeding it. I then need to add the numbers together.
Example
... (5 Replies)
Hi,
I have file 1.txt with following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433
**
**
**
In file 2.txt I have the following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433... (4 Replies)