Script code


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script code
# 1  
Old 08-27-2015
RedHat Script code

hello,
I have these 2 lines below for instance

Code:
apple  beta  cat  dog  egg   zoo   yellow  suze
fat    goon  hat  ink  kite

the eventual outcome i want is
Code:
yellow    ink

how do i do this?
thanks

NB...this is for bash in linux...

Last edited by Don Cragun; 08-27-2015 at 05:09 PM.. Reason: Add CODE tags.
# 2  
Old 08-27-2015
Hi

Please use the [code]code tags[/code], as you have agreed by the forum rules.

Is this homework?
If so, please read the https://www.unix.com/homework-coursew...ons-forum.html to post within: https://www.unix.com/homework-and-coursework-questions/
# 3  
Old 08-27-2015
Please use code tags as required by forum rules!

This specification is utterly sparse. How do you identify the fields that you want to extract? Second last in line? Does the output have to be all fields in one line, separated by a space?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell Script - Alphabet in code

Hi e Hi everyone, I can't make this script work, #! /bin/bash declare -A crypt=( ="A" ="a" ="B" ="b" ="C" ="c" =' ' ='!' ) encode () { local word=$1 for ((i=0; i<${#word}; ++i)) ; do local char=${word:$i:1} printf %s' ' ${crypt} done ... (5 Replies)
Discussion started by: Pinguino
5 Replies

2. Shell Programming and Scripting

How to capture the exit code of a shell script in a perl script.?

hi, i want to pop up an alert box using perl script. my requirement is. i am using a html page which calls a perl script. this perl script calls a shell script.. after the shell script ends its execution, i am using exit 0 to terminate the shell script successfully and exit 1 to terminate the... (3 Replies)
Discussion started by: Little
3 Replies

3. Shell Programming and Scripting

Help with Shell script code

Hello all, I am in a middle of an assignment and i would appreciate any help. How can i write a bash shell script code that checks if all elements in an array are the same numbers. I mean -->array = ( 0,0,0,0,0 ) ( e.g., if then return "OK' fi ) Thank you in advance, (9 Replies)
Discussion started by: Geekie
9 Replies

4. Shell Programming and Scripting

How to capture exit code of child script and send it to parent script?

#!/usr/local/bin/bash set -vx /prod/HotelierLinks/palaceLink/bin/PalacefilesWait /prod/HotelierLinks/palaceLink/bin/prodEnvSetup 03212013 & if then echo "fatal error: Palace/HardRock failed!!!!" 1>&2 echo "Palace Failed" | mail -s "Link Failed at Palace/HardRock" -c... (1 Reply)
Discussion started by: aroragaurav.84
1 Replies

5. UNIX for Dummies Questions & Answers

script to match name with code?

I need a script that could take in a line from one file and match the line up with codes in the order file. My first file, called names.txt ,contains: >123456789 >987654321 >15946873 >157987513 The other file, called data,contains: GB_00012.faa GB_6789333.faa GB_100098.faa... (1 Reply)
Discussion started by: Iifa
1 Replies

6. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

7. Shell Programming and Scripting

Need to comment some code via script

Hi, I am writing a shell script, which should comment a if-fi loop in a file. From google i found that, we can use below qualifier to comment a section of code, :<<COMMENT COMMENT But i could not place these keywords before and after if-fi loop. Any help would be appreciated. Finally the... (2 Replies)
Discussion started by: successlin
2 Replies

8. Shell Programming and Scripting

code formatter for shell script

hello, do anybody know a program to format a shell script code ? i tried "editrocket.com" but this product doesn't format a shell script code. i searched for programs but can't find a shell script code formatter. i have to change a shell script and the style of code is ..... regards (5 Replies)
Discussion started by: bora99
5 Replies

9. Solaris

Pl explain the shell script code

if then ROLLBACK=1 ; elif then echo "Nothing to install!" ; echo "Exiting." ; exit 0; Plz explaing what is the ${1:-0} in if loop?:) (3 Replies)
Discussion started by: ysrikanth
3 Replies

10. Shell Programming and Scripting

return code from script

hey all, I have a simple script #!/bin/bash ./cron.sh test_a.txt & ./cron.sh test_b.txt & wait I want to invoke another program based on the return status of the above calls. How am I were to get that? Thanks! (2 Replies)
Discussion started by: mpang_
2 Replies
Login or Register to Ask a Question