sed 255 Character Limitation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed 255 Character Limitation
# 8  
Old 01-12-2016
Quote:
Originally Posted by Don Cragun
To replace the 391st character I think that would be:
Code:
sed 's/^\(.\{255\}.\{135\}\)./\1,/' file

True. My code was just meant as an example for duplicating the regexp.

Quote:
Originally Posted by Don Cragun
The standards say that systems must allow RE_DUP_MAX repeated occurrences of a BRE or ERE in an interval expression and that RE_DUP_MAX but be at least _POSIX_RE_DUP_MAX which is defined by the current standards to be 255. (This is for all BREs and EREs; not just BREs used in sed.)
Being the standard-legasthenic that i am i wasn't even aware of "RE_DUP_MAX" existing. Thank you for enlightening me!

Btw., here is such a (ksh-)-shell-function you proposed:

Code:
# function to create regexps with really big repeat-counts
# call: pRealManyOcc <int number> <string regex> -> success

function pRealManyOcc
{
typeset -i iNum=$1
typeset    chRegex="$2"
typeset    chResult=""

if [ $iNum -le 255 ] ; then
     return 1                    # what's the point, anyway
fi

chRegex="${chRegex//\\/\\\\}"    # to escape where no escaping has gone before

while [ $iNum -gt 255 ] ; do
     chResult="${chResult}${chRegex}\\\\{255\\\\}"
     (( iNum -= 255 ))
done

print - "${chResult}${chRegex}\\\\{${iNum}\\\\}"

return 0
}

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 9  
Old 01-12-2016
Hi,
LINE_MAX of sed from HP UX 11i is 2048, so this could work:
Code:
sed -e 's/\(.\)/\1 TAGMARK-1/'"$pos" -e 's/ TAGMARK-1./,/' file

But $pos limit is 2048...

Regards.
These 2 Users Gave Thanks to disedorgue For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
2 Replies

2. Shell Programming and Scripting

Sed: delete on each line before a character and after a character

Hi there, A total sed noob here. Is there a way using sed to delete everything before a character AND after another character on each line in a file? The deletion should also delete the indicating characters(here: an opening and a closing parenthesis). The original file would look like... (3 Replies)
Discussion started by: bnbsd
3 Replies

3. Shell Programming and Scripting

Ignore the 255 character limit of command line

Hi I would just like to ask if there is a way for UNIX to ignore/overcome the 255 character limit of the command line? My problem is that I have a really long line of text from a file (300+ bytes) which i have to "echo" and process by adding commands like "sed" to the end of the line, like... (5 Replies)
Discussion started by: agentgrecko
5 Replies

4. Shell Programming and Scripting

SED on AIX Limitation

Hello, I have a problem running a script created in ksh for Linux (Tested on Debian 5.0, Ubuntu Server 10.04 and RHEL 5.1), it works properly. :b: I trying to pass it to a AIX 5.3. :wall: The problem is the character limit of 256 on a command system and SED. I need to cut the contents of... (8 Replies)
Discussion started by: nemesis.spa
8 Replies

5. Shell Programming and Scripting

echo !SR | nc 255.255.2.2 80 - how to in XP?

Hi guys I am trying to interface with an old industrial scanner through an old PC with an old network card and a copy of Linux. It now needs to speak to a Windows XP machine, but I have no idea what the Windows equivalent of these functions would are: echo !1 | nc 255.255.2.2 80 echo ?2 | nc... (3 Replies)
Discussion started by: TonyG
3 Replies

6. Shell Programming and Scripting

In Sed how can I replace starting from the 7th character to the 15th character.

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)
Discussion started by: mohullah
5 Replies

7. Shell Programming and Scripting

Character limitation in Join command

Hi, I'm trying to compare and join two files using join command. One of my files length is 3000. Join is not working for this file. It truncates character after 1600 lines. Anyone know a solution for this? the command i used is Comparing the 1st column of the first file and 3rd column of... (1 Reply)
Discussion started by: gpaulose
1 Replies

8. UNIX for Dummies Questions & Answers

SED: Can't Repeat Search Character in SED Output

I'm not sure if the problem I'm seeing is an artifact of sed or simply a beginner's mistake. Here's the problem: I want to add a zero-width space following each underscore between XML tags. For example, if I had the following xml: <MY_BIG_TAG>This_is_a_test</MY_BIG_TAG> It should look like... (8 Replies)
Discussion started by: rhetoric101
8 Replies

9. Shell Programming and Scripting

sed limitation of 255 characters

Gurus, sed -e "s/\(.\{1,255\}\)\(.\{1,2\}\)\(.*\)/\1AB\3/" FILE ---this works sed -e "s/\(.\{1,468\}\)\(.\{1,2\}\)\(.*\)/\1AB\3/" FILE ---this does not It works only till 1,255 ( any number below 255 works) Any one know how to increase this limit. Thanks Sirababu (4 Replies)
Discussion started by: sirababu
4 Replies

10. HP-UX

HP-UX 11i - File Size Limitation And Number Of Folders Limitation

Hi All, Can anyone please clarify me the following questions: 1. Is there any file size limitation in HP-UX 11i, that I can able to create upto certain size of file (say 2 GB) and not more then that???? 2. At max. how many files we can able to keep inside a folder???? 3. How many... (2 Replies)
Discussion started by: sundeep_mohanty
2 Replies
Login or Register to Ask a Question