05-19-2009
divide a string into variables
i have
/tmp/dev/string1/testfile.txt
i need only testfile.txt
How can get that..can anyone helpme out
Thanx
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a variable which consists of a string like this:
001 aaabc 44 a bbb12
How do I extract each substring, delimited by the spaces, into new variables - one for each substring?
eg var1 will be 001, var2 will be aaabc, var3 will be 44, var4 will be a, etc?
I've come up with this:... (2 Replies)
Discussion started by: Sniper Pixie
2 Replies
2. Shell Programming and Scripting
Hello,
I am an intermediate scripter. I can usually find and adapt what I need by searching through previous postings, but I'm stumped.
I have a string with the format "{Name1 Release1 Type1 Parent1} {Name2 Release2 Type2 Parent2}". It is being passed as an argument into a ksh script. I need to... (5 Replies)
Discussion started by: drd_2b
5 Replies
3. Shell Programming and Scripting
HI all,
Very new to shell programming and just wanted some help on how to solve the following problem.
I have a small shell script which searches a given file and extracts some string parameters. I want to now be able to call this script from another shell script and somehow pass the parameters... (11 Replies)
Discussion started by: pxy2d1
11 Replies
4. Shell Programming and Scripting
I have two variables and want to perform some functions after comparison
$cat file1
14.abcde
a=`cut -f 1 -d "." file1
b=15
if
then
....
fi
but i got an error message says that unary operator expected
and i think its because of $a is a string and trying to compare with... (3 Replies)
Discussion started by: bonosungho
3 Replies
5. Shell Programming and Scripting
I'm working in korn shell and have a variable which contains a string like:
aa_yyyymmdd_bbb_ccc_ddd.abc. I want to treat the _ and . as delimiters and parse the string so I end up with 6 values in variables that I can manipulate. My original plan was to use
var1=`echo $sting1 | cut -c1-c2` but... (9 Replies)
Discussion started by: aquimby
9 Replies
6. Programming
Hello everybody... I'm new in this forum , and sorry if my english isn't very good!
I must create a client server application... and my problem is:
when the client connects to the server the first time, he has to register with a user name and a password! The client sends username and password in... (6 Replies)
Discussion started by: italian_boy
6 Replies
7. Shell Programming and Scripting
Hi,
i am new to Shell Scripting, i want to get some input from user which is string, and i want to store it into variables.
Eg:
str='hello how are you'
i want to store this string into 4variables
lyk s1=hello
s2=how
s3=are
s4=you
thanks,
lak (11 Replies)
Discussion started by: lakshmikanthe
11 Replies
8. Shell Programming and Scripting
I have the following:
#! /bin/bash
foo="bar"
this="that"
vars="foovar=$foo\n\
thisvar=$this\n"
I want to write the following to a file:
foovar="bar"
thisvar="that"
Then in another script, I pull this file, and loop through it:
while read line; do
eval $line
done <... (3 Replies)
Discussion started by: Validatorian
3 Replies
9. Shell Programming and Scripting
I have a file
$ cat myfile
A 02/16/2012
B 02/19/2012
C 02/20/2012
D 02/17/2012
E 02/16/2012
My simple script
> cat myscript.sh
mydate="02/16/2012"
awk ' ($2~/$mydate/) {print $1}' < myfile
but I got no output! and when I try $2~/'$mydate'/
I got: The error context is (2 Replies)
Discussion started by: Sara_84
2 Replies
10. Shell Programming and Scripting
Here is what I'm trying to do.
A query embedded with a unix variable is stored in the database table. When it is pulled out, it has a variable in it and it needs to be replaced by the variable passed to the script below.
1. select cast(cmd_string as varchar(1000)) from mytable where... (1 Reply)
Discussion started by: sheila_ga2013
1 Replies
LEARN ABOUT REDHAT
yencode
yencode(n) encode/decoding a binary file yencode(n)
NAME
yencode - encode/decoding a binary file
SYNOPSIS
package require Tcl 8
package require yencode ?1.0?
::yencode::encode string
::yencode::decode string
::yencode::yencode ?-name string? ?-line integer? ?-crc32 boolean? (-file filename | ?--? string)
::yencode::ydecode (-file filename | ?--? string)
DESCRIPTION
This package provides a Tcl-only implementation of the yEnc file encoding. This is a recently introduced method of encoding binary files
for transmission through usenet. This encoding packs binary data into a format that requires an 8-bit clean transmission layer but that
escapes characters special to the NNTP posting protocols. See http://www.yenc.org/ for details concerning the algorithm.
::yencode::encode string
returns the yEnc encoded data.
::yencode::decode string
Decodes the given yEnc encoded data.
::yencode::yencode ?-name string? ?-line integer? ?-crc32 boolean? (-file filename | ?--? string)
Encode a file or block of data.
::yencode::ydecode (-file filename | ?--? string)
Decode a file or block of data. A file may contain more than one embedded file so the result is a list where each element is a three
element list of filename, file size and data.
OPTIONS
-filename name
Cause the yencode or ydecode commands to read their data from the named file rather that taking a string parameter.
-name string
The encoded data header line contains the suggested file name to be used when unpacking the data. Use this option to change this
from the default of "data.dat".
-line integer
The yencoded data header line contains records the line length used during the encoding. Use this option to select a line length
other that the default of 128. Note that NNTP imposes a 1000 character line length limit and some gateways may have trouble with
more than 255 characters per line.
-crc32 boolean
The yEnc specification recommends the inclusion of a cyclic redundancy check value in the footer. Use this option to change the
default from true to false.
% set d [yencode::yencode -file testfile.txt]
=ybegin line=128 size=584 name=testfile.txt
-o- data not shown -o-
=yend size=584 crc32=ded29f4f
KEYWORDS
encoding, uuencode, yEnc, yencode, ydecode
base64 1.0 yencode(n)