Below is a simple script that allows the use of the Unix paste utility. However, when I try and run the script, it gives me the following errors:
pastescript: ^M: not found
pastescript: ^M: not found
pastescript: syntax error at line 24: `in^M' unexpected
Could anyone tell me what's wrong with this? Any help would be appeciated.
Code:
while [ 5 -eq 5 ]
do
clear
print "
---------------------------------------------------
menu
--------------------------------------------------- "
print "This is menu"
print "\n"
print " 1: menu1"
print " 2: menu2"
print "\c"
print " 3: menu3"
print "\c"
print " 4: menu4"
print "\c"
print " 0: Exit the Program"
print "\c"
case "$case1" in
1)
print " hit enter for menu"
;;
2)
print "hit enter for menu"
;;
3)
print "enter some files to paste"
read a b
print " ----------------------------------------------------------------- "
print "
1) (delete this- wrtie a paste option here)
2) same
3)
\n"
print "Enter a PASTE option (number) : \c"
read paste2
case "$paste2" in
1)
paste $a $b
echo hit enter for menu
;;
2)
paste $a $b
echo hit enter for menu
;;
3) paste $a $b
echo hit enter for menu
;;
*) #if no Numerical option is selected - display this error messag
print "You DID NOT select a Numerical option"
echo hit enter fro the menu
;;
esac
;;
4)# number 4 from first case
;;
5)
;;
0)
exit
;;
*)
# CASE
clear
print "
---------------------------------------------------
Menu
--------------------------------------------------- "
print "This is menu"
print "\n"
print " 1: menu1"
print " 2: menu2"
print "\c"
print " 3: menu3"
print "\c"
print " 4: menu4"
print "\c"
print " 0: Exit the Program"
print "\c"
echo choose an option
;;
*)
# This is the last line that displays:
echo choose an option
;;
esac
read case1
done
Last edited by blowtorch; 01-17-2007 at 11:03 PM..
Reason: code tags
I really need to make a paste script to ease and simplify the UNIX paste facility. I really have NO idea where to start, other than the first line initializing the korn shell.
I'd like the script to be interactive, with options and file names being imputted after the pograms prompts! Any help... (0 Replies)
I'm attempting to create a Perl script that will:
Take the contents of the usernames.tmp file
(usernames.tmp is created from an awk one-liner ran against /etc/passwd)
Take one line at a time and pass it to the su command as a users name.
This should go on until there is no more name to... (10 Replies)
how can i make a script or command to have output like this
$cat file
10000 20000
$cat a
10000
$cat b
20000
this is the solution paste a b > file
but another solution?
$cat file
10000 20000 (3 Replies)
Hi
I want to grep for a line and copy and paste that line.
for Example
---- file abc.txt ----
host=atlx1 sid=atld1 mail=abc@abc.com
host=atlx2 sid=atld2 mail=xyz@abc.com
host=atlx3 sid=atld3 mail=def@abc.com
host=atlx4 sid=atld4 mail=mno@abc.com
--- end of file abc.txt ----
Now I... (16 Replies)
hi,
I have a file with content like this for an employee:
EmployeeID
101
Day_type, day
vacation,1/2/2009
sick day, 3/2/2009
personal day, 4/5/2009
jury duty day, 5/5/2009
how do I make the result to show:
EmployeeID,Day_type,day
101,vacation,1/2/2009
101,sick day,... (6 Replies)
paste -d "\0" ap_cntrl_total.txt.1 ap_cntrl_total.txt.2, and it shows:
01234567890911051342C091026 0000910517990000000000009105179900000000CHOPME
it put space btwn 1026 and 000091
should not have space.
---------- Post updated at 03:54 PM ---------- Previous update was at 03:03 PM... (1 Reply)
Dear All,
I have thousands of files (consists of one column each) and i need to paste all the columns in a single file as follows:
I have files - file1, file2, file3, .......file2000.
I need to paste all the files in a single file of separate columns as shown below:
file1 file2 file3 ... (3 Replies)
Hello Guys,
I know the command echo " " > filenamehere ; would erase everything in the document. Can the same be done, to paste words below certain text?
For example, lets say i want to paste a line below the line Server name: in apache.conf . What should be added in the script? (8 Replies)
Hi,
When I use the paste command in the terminal window it works fine, but when i try to use it in a bash script file i get errors. I'm not sure how to use the paste command in a bash script file.
my paste command looks like this
paste <( code1 ) <(code2)
thanks (7 Replies)
Hai ,
When i use paste command in command prompt its giving expected output but not in the script. Below is the example.
$cat file
1
2
3
$cat file1
4
5
6
$paste -d ':' file file1
1:4
2:5
3:6
but when i used the same command in script its giving the output as below :
1
2
3 (3 Replies)
Discussion started by: Subbu123
3 Replies
LEARN ABOUT OPENSOLARIS
script
script(1) User Commands script(1)NAME
script - make record of a terminal session
SYNOPSIS
script [-a] [filename]
DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the
record is saved in the file typescript. See WARNINGS.
The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends
when the forked shell exits or when Control-d is typed.
OPTIONS
The following option is supported:
-a Appends the session record to filename, rather than overwriting it.
NOTES
script places everything that appears on the screen in filename, including prompts.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
SEE ALSO attributes(5)WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a
privileged user, that is, root. Be sure that typescript is not a link before running script.
SunOS 5.11 30 Jan 2004 script(1)