How to create this on bash?


 
Thread Tools Search this Thread
Top Forums Programming How to create this on bash?
# 1  
Old 01-09-2012
How to create this on bash?

I'm trying to create a script with the ff array

array 1 - foo@fee.com,fee@fee.com,fyii@fee.com (1 line)

array 2 - paul

what I want is to have the ff output in a text file

Code:
foo@fee.com: paul
fee@fee.com: paul
fyii@fee.com: paul

Could this be done on a bash script?

I'm trying this one

Code:
array2=`echo $alias | sed 's/\,/\n/g'`
echo "$array2: $array1"

But the output is

Code:
fee@fee.com
fee@fee.com
fyii@fee.com: paul

Any suggestions?
# 2  
Old 01-09-2012
Your question is unclear. This will print what you want:
Code:
VAR=foo@fee.com,fee@fee.com,fyii@fee.com
VAR2=paul

OLDIFS="$IFS"; IFS=","
for X in $VAR
do
        echo $X:$VAR2
done
IFS="$OLDIFS"

...but I suspect isn't actually what you want.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to create variables to pass into a bash loop to create a download link

I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Discussion started by: cmccabe
8 Replies

2. Shell Programming and Scripting

Create a two column output in bash

Hi! I m newbie for scripting. My requirement is to create a host file as below from the output of aws api. Hostname PrivateIP abc x.y.x.z cde a.b.c.c and so on. I have the following script, #!/bin/bash export AWS_ACCESS_KEY=abc export... (5 Replies)
Discussion started by: cuteboyucsc
5 Replies

3. Shell Programming and Scripting

How to create an executable bash script for these commands?

I wish to create an executable bash script that will run the following commands as root, that is, using sudo su iptables-save | awk '/^ / { print $1 } /^:+ / { print $1 " ACCEPT" ; } /COMMIT/ { print $0; }' | iptables-restoreMy first attempt at bash... (9 Replies)
Discussion started by: thixeqi
9 Replies

4. Shell Programming and Scripting

Create excel file using bash script

i have written one script which generates text file which gives output like. 001.config: CR1.1 COMPILE_PASSED TEST_PASSED 002.config: CR1.1 COMPILE_FAILED TEST_FAILED . . .so on this text file will get filled one by one as its for loop for n number. i... (7 Replies)
Discussion started by: RamMore123
7 Replies

5. Shell Programming and Scripting

Not able to create alias in bash Sun solaris

Hello Friends, I am facing problem in creating aliases. I am working in SunOS 5.10. When I login in system i have been given ksh shell. What i am doing is that ? I am changing shell to bash then I am creating 2 alias in command prompt like: alias deploy_dir=' cd... (4 Replies)
Discussion started by: krsnadasa
4 Replies

6. Shell Programming and Scripting

Bash code to create named Pipe

Guy's, I need help with creating a pipe, I found this code online but not exactly sure what different parts are doing. Will someone be able to help me with explaining what code is doing? Also what I want is to have everything the same directory. Meaning I am working in directory: I want... (5 Replies)
Discussion started by: INHF
5 Replies

7. Shell Programming and Scripting

How can we create a string table in bash shell ?

Hello, How can we write the pseudo code below using Bash shell scripting? table = ; i=0; do{ grep table h.txt; }while(i<3); or table = ; i=0; for(i=0;i<3;i++) grep table h.txt; (4 Replies)
Discussion started by: dbgork
4 Replies

8. UNIX for Dummies Questions & Answers

create time sequence in bash

hi all, hope someone can assist in this. I'm trying to make a sequence of time in bash so that the output prints the following; 1950-01-01 1950-02-01 1950-03-01 ... 1999-11-01 1999-12-01 In R, i can issue the following command; t1 <- ISOdate(1950,1,1,0,0,0) t2 <-... (0 Replies)
Discussion started by: Muhammad Rahiz
0 Replies

9. Shell Programming and Scripting

[ORACLE] CREATE TABLE in bash

Hey, I want to create a table in bash, my db server is oracle. You can find my script below: I am very confused. I tried to run this script many times without any luck. Please help! (6 Replies)
Discussion started by: radek
6 Replies

10. Shell Programming and Scripting

I need to create a script in bash as follows:

List junk subdirectory in multi-column format Echo/Read : Ask for filename Test for existence of junk/filename True: Test for file size: Size=0: Display "filename exists, but size is zero" Size>0: Display a full listing... (3 Replies)
Discussion started by: POPOPO
3 Replies
Login or Register to Ask a Question