Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
45 user(s) are online (34 user(s) are browsing Forums)

Members: 0
Guests: 45

more...

Support us!

Headlines

 
  Register To Post  

Wildcards and special characters in shell
Just can't stay away
Just can't stay away


See User information
Is there anywhere, where the special characters used in interpreting strings in the shell is documented?? I know that *N is newline, but is there a character for tab as well? I tried *T, but it doesn't seem to work...

Also I could use a brushup on the general use of wildcards, but I can't seem to find anything in sys:Documentation...


Edited by orgin on 2011/12/9 17:41:30
Go to top
Re: Wildvards and special characters in shell
Not too shy to talk
Not too shy to talk


See User information
@alfkil

i'm also new to the shell in AmigaOS. for wildcards i use two options:

1. if i only want one and only one character wild, i use the '?' operator. for example:

System:> dir foo.?.txt

2. if i want any number of characters wild, akin to the '*' operator in the POSIX world, i use '#?' instead. for example:

System:> dir foo.#?

hope this helps.

-- eliyahu

"Physical reality is consistent with universal laws. When the laws do not operate, there is no reality. All of this is unreal."
Go to top
Re: Wildvards and special characters in shell
Not too shy to talk
Not too shy to talk


See User information
@thread

i would also recommend this site for amiga manuals in PDF form. commodore-era manuals, application and game manuals, scanned books, all available.

there are amigaDOS manuals there -- old, but still useful. another source for the original, combined amigaDOS manual circa 1986 can be found here.

-- eliyahu

Go to top
Re: Wildvards and special characters in shell
Amigans Defender
Amigans Defender


See User information
There are loads of wildcards - your best bet is the ParsePattern() AutoDoc.

Not sure about escaped characters though - I'd suggest the AmigaDOS 3.1 (or 3.5 updated) manual. I'll have a look through some of my old amigaDOS manuals when I get home to see if I can find a comprehensive list.

Go to top
Re: Wildvards and special characters in shell
Just can't stay away
Just can't stay away


See User information
@alfkil
Quote:
Is there anywhere, where the special characters used in interpreting strings in the shell is documented?? I know that *N is newline, but is there a character for tab as well? I tried *T, but it doesn't seem to work...

The OS3.1 DOS manual only list 4 pairs of special characters for use in AmigaDOS commands: *E *N *" ** There may be an ANSI/ASCII escape sequence for embedding a TAB but I've never seen an example of that.

Quote:
Also I could use a brushup on the general use of wildcards, but I can't seem to find anything in sys:Documentation...

Look at the DOS autodoc in the SDK under the ParsePattern() function.

Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

Go to top
Re: Wildcards and special characters in shell
Just can't stay away
Just can't stay away


See User information
Thanks for all the input, I think I am getting a hang of it now.

Strange, though, that there is no way to send a tab character to a program, that could have been really useful.

The reason I am looking for this, is because I am looking for easy ways to replace strings in large sourcecode files with other strings. Now I am looking at sed the stream editor, and I think from using it a little and cross refering what I do on my pc, I think that sed has problems with the * character. I checked the DOS prefs, and "use asterisk in patterns" is turned off.

I'm trying to replace strings using something like this:

Original file:
DC.B "string",10,0

Wanted result:
.string "string"
.byte 10,0

sed command:
> sed "s/DC.B\t\"\([[:space:]0-9a-zA-Z]*\)\",\([01,]*\)/.string \"\1\"\n\t.byte \2/" myfile.asm >.log

Under cygwin it works, but on amiga it doesn't (in shell or sh). I was trying to look for the sources of sed on aminet, but it seems to be down... What to do??

Go to top
Re: Wildcards and special characters in shell
Not too shy to talk
Not too shy to talk


See User information

You don't need a special character to represent tab. Just press the tab key.

To escape the * character just enter another * (**).


Go to top
Re: Wildcards and special characters in shell
Just can't stay away
Just can't stay away


See User information
@thomas

The tab key is used for completion in Shell, so all tabs entered are swallowed. At least that's what it does here.

I have tried double ** with sed, but it still doesn't work.

Go to top
Re: Wildcards and special characters in shell
Amigans Defender
Amigans Defender


See User information
Surely sed will use \t for tabs? Doesn't it use Perl-style regular expressions?

Go to top
Re: Wildcards and special characters in shell
Just can't stay away
Just can't stay away


See User information
@alfkil
I can't help but think that it must be possible to embed tabs in AmigaDOS with escape codes but I can't get it to work. However, I have found a dumb way to send tabs to a text file using AmigaDOS. Here is an example:

eval 0x9 LFORMAT "%C" >ENV:tab
echo "Testing tabs" >ram:test NOLINE
echo "$tab" >>ram:test NOLINE
echo "here." >>ram:test

If you enter the above commands in a shell, you should end up with a line containing a TAB before the word "here" in the file ram:test. If you can't find a better way, you should be able to use my method.


Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

Go to top
Re: Wildcards and special characters in shell
Just can't stay away
Just can't stay away


See User information
>alfkil
Is there anywhere, where the special characters used in interpreting strings in the shell...
What's the context? DOS or ABC shell?

>Chris
Surely sed will use \t for tabs? Doesn't it use Perl-style regular expressions?
ABC shell uses all the commands from "Bash" doesn't it! Best formatting text processing language is AWK.

Go to top
Re: Wildcards and special characters in shell
Home away from home
Home away from home


See User information
If using sed compiled with clib2 set

DISABLE_COMMANDLINE_WILDCARD_EXPANSION

read clib2/include/dos.h

for more info

Ideally the app should have set the flag internally but some clib2 utils haven't




Go to top
Re: Wildcards and special characters in shell
Quite a regular
Quite a regular


See User information
I'd just see the sed documentation for numeric, ie. use the hexadecimal value for *, I did this for some other character when I needed it (you need 0x2A).

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project