Zero typing problem!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Zero typing problem!
# 8  
Old 10-19-2012
I guess you did not get the implication that you need to use one of the suggestions
in your code. Rewrite the code with pamu's suggestion:
Code:
#!/bin/sh
str=$@
echo "$str" | nawk -F '\\' '{ print $NF}'
exit

Just tested it - NOTE: you have to put tics around the filename
Code:
./t.shl 'abc\0000\abc'
abc

I called my script t.shl

Last edited by jim mcnamara; 10-19-2012 at 11:37 AM..
# 9  
Old 10-22-2012
Hi Jim

You solution has not worked for me,
I put
Code:
./convert.sh "\\code\abc\asaks\00000asjahsjs vvfivfh.txt

and I got output:
Code:
asaks00000asjahsjs vvfivfh.txt

as output
Smilie
Quote:
Originally Posted by jim mcnamara
I guess you did not get the implication that you need to use one of the suggestions
in your code. Rewrite the code with pamu's suggestion:
Code:
#!/bin/sh
str=$@
echo "$str" | nawk -F '\\' '{ print $NF}'
exit

Just tested it - NOTE: you have to put tics around the filename
Code:
./t.shl 'abc\0000\abc'
abc

I called my script t.shl
# 10  
Old 10-22-2012
Quote:
Originally Posted by nixhead
Hi Jim

You solution has not worked for me,
Please show us what you have tried...

check this .. at least one should work for you...Smilie

Code:
$ cat test.sh
#!/bin/sh
str=$@
echo "1 - awk"
echo "$str" | awk -F '\\' '{ print $NF}'
echo "2 - sed"
echo "$str" | sed 's/.*\\//g'
echo "3 - tr + awk"
echo "$str" | tr '\\' '\n' | awk 'END{print }'
exit

$ sh test.sh "\\code\abc\asaks\00000asjahsjs vvfivfh.txt"
1 - awk
00000asjahsjs vvfivfh.txt
2 - sed
00000asjahsjs vvfivfh.txt
3 - tr + awk
00000asjahsjs vvfivfh.txt

# 11  
Old 10-22-2012
Quote:
Originally Posted by nixhead
Hi Jim

You solution has not worked for me,
I put
Code:
./convert.sh "\\code\abc\asaks\00000asjahsjs vvfivfh.txt

and I got output:
Code:
asaks00000asjahsjs vvfivfh.txt

as output
Smilie
That is not the same. You are using double quotes instead of single quotes (and you left out the second quote).
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. HP-UX

@ typing creates new line

Dear Concern, Please go through the article https://www.unix.com/hp-ux/134072-typing-sign-creates-new-line.html As per the article, we need to initiate below commands. But after creating new session, we face same problem. Please advise. stty intr "^c" stty kill "^u" Please find below... (6 Replies)
Discussion started by: makauser
6 Replies

2. UNIX for Dummies Questions & Answers

No $ when typing cw

Hi As a dummy my question is very simple. When typing cw I've read (many times) that a '$' should appear at the end of the word I'm about to change. However, it doesn't, and in my case the word is instantly deleted and so ready to be changed! Can somebody tell me why this is, or maybe I... (4 Replies)
Discussion started by: joesh
4 Replies

3. UNIX for Advanced & Expert Users

Determining typing latency

Hi all, When I use an editor (vi) that is spawned in a remote server, visually I could see the latency between typing a character/word and being displayed on the terminal. I could see this visually but how do I get a metric on this or how to quantify this? As expected, when I type in a editor... (6 Replies)
Discussion started by: matrixmadhan
6 Replies

4. Shell Programming and Scripting

No output to CL when typing in CL.

Hello all, I am in a terminal on Solaris and something weird is happening... When I am typing I can't see what I am typing, although what I am typing is working. As is if I type the command and hit enter, the command runs. Anyone have a clue why or how I can make it display my typing? Is... (2 Replies)
Discussion started by: komputersman
2 Replies

5. UNIX and Linux Applications

Learn typing in Chinese

I have a burning desire to learn how to type in chinese (and after, probably with success, in another languages). How to do this, all symbols are needed, and methods of input also. And a map of chinese keyboar layout will be helpful. I want very much study program. (3 Replies)
Discussion started by: Xcislav
3 Replies

6. UNIX for Dummies Questions & Answers

Stuck after typing goto

uname -a returns: SMP Tue May 17 17:52:23 EDT 2005 i686 athlon i386 GNU/Linux I have many aliases beginning with "goto" so... if I type goto and then hit return (oops) A goto prompt pops up and I cant exit from it(I tried MANY key seqs) The only way to exit is to kill the term window... (2 Replies)
Discussion started by: rairey
2 Replies

7. UNIX for Advanced & Expert Users

Hiding Passwords while typing..

Hi, We need ur advice,... We are integrating our application (oracle) with OID,and OID is with another team. While integrating they have to provide their 'ADMIN-password' when the script prompts ,But the password they are about type is visible. If this is the case they are denying it,.... Is... (1 Reply)
Discussion started by: rrs
1 Replies
Login or Register to Ask a Question