Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using sed to remove spaces from middle of the line Post 302904373 by friedmi on Tuesday 3rd of June 2014 05:18:40 PM
Old 06-03-2014
Thank you, Don for prompt reply.
These are my examples.

Original line:
Code:
<td width=251 colspan=9 rowspan=22> <font size=2 face="courier"><tt><style>{font:7pt Courier  New;color:#000000}</style><a  href="/webaccess/AIntRez.cgi?ser ver=rsrv&report=%2Fdev%2Fypa%2Fhome%2Fentk ppa%2FTSTREP%2Freports%2FGET_TRANS ACTION_2000.rep&desformat=pdf&bat ch=yes&destype=file&p_date_time=200 807091331278990&p_batch_seqno=1&p_t ransaction_seqno=2&P_SESSION_ID=999999&P_ START_LINE=&P_END_LINE="  target="main">07/09/2008 13:31</a></tt></font><br></td>

Expected result:
Code:
<td width=251 colspan=9 rowspan=22> <font size=2 face="courier"><tt><style>{font:7pt Courier  New;color:#000000}</style><a href="/webaccess/AIntRez.cgi?server=rsrv&report=%2Fdev%2Fypa%2Fhome%2Fentkppa%2FTSTREP%2Freports%2FGET_TRANSACTION_2000.rep&desformat=pdf&batch=yes&destype=file&p_date_time=200807091331278990&p_batch_seqno=1&p_transaction_seqno=2&P_SESSION_ID=999999&P_START_LINE=&P_END_LINE=" target="main">07/09/2008 13:31</a></tt></font><br></td>

Original line:
Code:
<td width=183 colspan=10 rowspan=32> <font size=2 face="courier"><b><tt><style>{font:9pt Courier  New;color:#000000}</style ><a  href="/webaccess/AIntR ez.cgi?server=rsrv&rep ort=%2Fdev%2Fypa%2Fhome%2 Fentkppa%2FTSTREP%2Frepo rts%2FORDER_DETAIL_2000 .rep&desformat=pdf&batch= yes&destype=file&p_direct ory_number=000001&p_client _number =7500&p_dir_ver_stat=CURR ENT&p_req_mailbox_name=TS TUSER" target="main">  Current Order </a></tt></b></font><br></td>

Expected result:
Code:
<td width=183 colspan=10 rowspan=32> <font size=2 face="courier"><b><tt><style>{font:9pt Courier  New;color:#000000}</style ><a href="/webaccess/AIntRez.cgi?server=rsrv&report=%2Fdev%2Fypa%2Fhome%2Fentkppa%2FTSTREP%2Freports%2FORDER_DETAIL_2000.rep&desformat=pdf&batch=yes&destype=file&p_directory_number=000001&p_client_number=7500&p_dir_ver_stat=CURRENT&p_req_mailbox_name=TSTUSER" target="main">  Current Order </a></tt></b></font><br></td>

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to remove spaces in a string using sed.

Hello, I have the following to remove spaces from beginning and end of a string. infile=`echo "$infilename" | sed 's/^ *//;s/ *$//` How do I modify the above code to remove spaces from beginning, end and in the middle of the string also. ex: ... (4 Replies)
Discussion started by: radhika
4 Replies

2. Shell Programming and Scripting

How to 'sed' the middle line?

Hi, If I have 90 lines and I want to print the 45th line, is there a quick sed command for this? thx. (7 Replies)
Discussion started by: g_jumpin
7 Replies

3. Shell Programming and Scripting

remove leading spaces from a line

Hi friends I need some help, I have a file which looks as follows TEMP 014637065 014637065 517502 517502 RTE 517502 517502 RTE AWATER_TEST 12325 23563 588323 2323 5656 32385 23235635 ANOTHER_TEST 12 5433 FTHH 5653 833 TEST 123 123 3235 5353 353 53 35 353 535 3 YTERS GJK JKLS ... (6 Replies)
Discussion started by: lijojoseph
6 Replies

4. Shell Programming and Scripting

Remove extra spaces in a line

Hi, I need a help in deleting extra spaces in a text. I have a huge file, a part of it is :- 3 09/21/08 03:32:07 started undef mino Oracle nmx004.wwdc.numonyx.com Message Text : The Oracle session with the PID 1103 has a CPU time ... (6 Replies)
Discussion started by: vikas027
6 Replies

5. Shell Programming and Scripting

sed over writes my original file (using sed to remove leading spaces)

Hello and thx for reading this I'm using sed to remove only the leading spaces in a file bash-280R# cat foofile some text some text some text some text some text bash-280R# bash-280R# sed 's/^ *//' foofile > foofile.use bash-280R# cat foofile.use some text some text some text... (6 Replies)
Discussion started by: laser
6 Replies

6. Shell Programming and Scripting

How to remove spaces using awk,sed,perl?

Input: 3456 565 656 878 235 8 4 8787 3 7 35 878 Expected output: 3456 565 656 878 235 8 4 8787 3 7 35 878 How can i do this with awk,sed and perl? (10 Replies)
Discussion started by: cola
10 Replies

7. Shell Programming and Scripting

tr and sed remove spaces. how to stop this?

if the answer is obvious, sorry, I'm new here. anyway, I'm using tr to encrypt with rot-13: echo `cat $script | tr 'a-zA-Z' 'n-za-mN-ZA-M'` > $script it works, but it removes any consecutive spaces so that there is just one space between words. I've had this problem before while using sed to... (5 Replies)
Discussion started by: Trichopterus
5 Replies

8. Shell Programming and Scripting

sed remove newlines and spaces

Hi all, i am getting count from oracle 11g by spooling it to a file. Now there are some newline characters and blank spaces i need to remove these. pl provide me a awk/sed solution. the spooled file is attached. i tried this.. but not getting req o/p (6 Replies)
Discussion started by: rishav
6 Replies

9. Shell Programming and Scripting

How to remove spaces on a line?

Hi, suppose I have the following data: albert music=top40 age=20 bob music=punk rock age=25 candy music=r n b age=22 dave music=mozart or bach only age=30 I want to extract and manipulate the music column but it's got spaces in it. How can I substitute the space with an underscore... (2 Replies)
Discussion started by: almonds
2 Replies

10. Shell Programming and Scripting

Can't remove spaces with sed when calling it from sh -c

The following command works echo "some text with spaces" | sh -c 'sed -e 's/t//g''But this doesn't and should echo "some text with spaces" | sh -c 'sed -e 's/ //g''Any ideas? (3 Replies)
Discussion started by: Tribe
3 Replies
Locale::Codes::LangExt(3)				User Contributed Perl Documentation				 Locale::Codes::LangExt(3)

NAME
Locale::Codes::LangExt - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangExt; $lext = code2langext('acm'); # $lext gets 'Mesopotamian Arabic' $code = langext2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langext_codes(); @names = all_langext_names(); DESCRIPTION
The "Locale::Codes::LangExt" module provides access to standard codes used for identifying language extensions, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language extensions. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langext('acm','alpha'); $lext = code2langext('acm',LOCALE_LANGEXT_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from the IANA language registry, such as 'acm' for Mesopotamian Arabic. This is the default code set. ROUTINES
code2langext ( CODE [,CODESET] ) langext2code ( NAME [,CODESET] ) langext_code2code ( CODE ,CODESET ,CODESET2 ) all_langext_codes ( [CODESET] ) all_langext_names ( [CODESET] ) Locale::Codes::LangExt::rename_langext ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangExt::add_langext ( CODE ,NAME [,CODESET] ) Locale::Codes::LangExt::delete_langext ( CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_alias ( NAME ,NEW_NAME ) Locale::Codes::LangExt::delete_langext_alias ( NAME ) Locale::Codes::LangExt::rename_langext_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::delete_langext_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2013-02-27 Locale::Codes::LangExt(3)
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy