Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Shell script - add ) at the end of each line

Posted on 2012-08-22
3
Medium Priority
?
386 Views
Last Modified: 2012-08-27
Hi,

What would be the sed commend to add a ) at the end of each line of a txt file that has 3M lines like this...

FileData(ORIGINATOR, 3343437)
{
CreateSubscription(){DestinationAddress(50522200010) Imsi(710210132268827
CreateSubscription(){DestinationAddress(50522200011) Imsi(710210132266017
CreateSubscription(){DestinationAddress(50522200012) Imsi(710210132266018
CreateSubscription(){DestinationAddress(50522200013) Imsi(710210132266019
CreateSubscription(){DestinationAddress(50522200014) Imsi(710210132266020
CreateSubscription(){DestinationAddress(50522200015) Imsi(710210132266021
CreateSubscription(){DestinationAddress(50522200016) Imsi(710210132266022

Tks.
Joao
0
Comment
Question by:joaotelles
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 38322582
sed 's/$/)/' filename

Open in new window


If you want to make permanent changes to the file use option -i

sed -i 's/$/)/' filename

Open in new window


NOTE: Make sure you use sed without -i first and are happy with the output.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 38322598
If you want to add ) at the end of lines with that start with CreateSubscription, then command would be:

sed'/CreateSubscription.*/&)/' filename

Open in new window

0
 

Author Closing Comment

by:joaotelles
ID: 38336172
tks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question