10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I want to set 10 set of strings into a variable where:
removing all spaces within each string
change the delimiter from "|" to ","
Currently, I've the below script like this:Table=`ten character strings with spaces in-between and each string with delimiter "|" | tr -d ' ' |... (7 Replies)
Discussion started by: o1283c
7 Replies
2. Shell Programming and Scripting
Hi,
I'm using awk to print columns from a tab delimited text file:
awk '{print " "$2" "$3" $6"}' file
The problem I have is column 6 contains text with spaces etc which means awk only prints the first word.
How can I tell awk to print the whole column content as column 6?
Thanks, (10 Replies)
Discussion started by: keenboy100
10 Replies
3. Shell Programming and Scripting
Hey guys,
I'm new to shell scripting and I'm trying to write a script that takes user input and copies the specified columns from a data file to a new one. In order to account for the possibility of a variable number of columns to copy I wrote a loop that encodes the user's choices in an array... (16 Replies)
Discussion started by: shaner
16 Replies
4. UNIX for Dummies Questions & Answers
I have simple test.sh script, see below:
bill_code=`echo $record | awk -F"|" '{print $1}'`
Fullname=`echo $record | awk -F"|" '{print $3}'`
email=`echo $record | awk -F\ '{print $4}'`
The last field contains spaces: see csv below:
A0222|Y|DELACRUZ|-cc dell@yahoo.com-cc support@yahoo.com
... (9 Replies)
Discussion started by: quay
9 Replies
5. Shell Programming and Scripting
Hi All,
I want to pass few dynamic arguments to shell script. The number of arguments differ each time I call the script.
I want to print the arguments using the for loop as below. But not working out.
for (( i=1; i<=$#; i++ ))
do
echo $"($i)"
done
/bin/sh test.sh arg1 arg2 arg3
... (1 Reply)
Discussion started by: laalesh
1 Replies
6. UNIX for Dummies Questions & Answers
Hey all,
How do I make a script print its arguments in reverse order?
Thanks (5 Replies)
Discussion started by: unclepickle1
5 Replies
7. UNIX for Dummies Questions & Answers
When I use:
find . -ls | awk 'BEGIN { OFS = ";"} {print $1,$2,$11}'I get a nice result, yet the files with spaces in it show only the first word and all other characters after the blank space are not printed.
e.g. 'file with a blank space'
is printed
file
'file_with a blank space'
is... (7 Replies)
Discussion started by: dakke
7 Replies
8. Shell Programming and Scripting
Let's say I want to print the arguments $4 till $#, how can I do this?
$# contains the number of arguments
$@ contain all the arguments as string
What i need is something like
for i in $4_till_$#; do
#do something with $i
convert $i ~/$output
done
The first 3 arguments are used as options... (6 Replies)
Discussion started by: hakermania
6 Replies
9. Shell Programming and Scripting
Hello all,
I want to list the file contents of the directory and number them. I am using la and awk to do it now,
#ls |awk '{print NR "." $1}'
1. alpha
2. beta
3. gamma
The problem I have is that some files might also have some spaces in the filenames.
#ls
alpha beta gamma ... (7 Replies)
Discussion started by: grajp002
7 Replies
10. Shell Programming and Scripting
I want to be able to read in input which contain spaces and put that into an array. Each field should be delimeted by a space and should be a different array element. However I cant get it to work. any tips?
read input
//type field1 field2 field3
echo "$input"
array="$input"
Thanks in... (11 Replies)
Discussion started by: Calypso
11 Replies