?
Solved

script that produces a file according to input

Posted on 2010-01-04
2
Medium Priority
?
263 Views
Last Modified: 2013-12-26


Hi all,



I need a script (mine is not going very well) that should work like this.



1) The user inputs numbers like this (just an example the numbers will not increment like that), or they can be read from a file as well.

> 2  3

> 4  5

> 6  7

... and so  on (always two numbers per line)



2) the script shall then produce a file with the following result:



<bla ble bla0=2  bla1=4  ble0=3  ble1=5>

<bla bla bla0=4  bla1=6  ble0=5  ble1=7>



Can you see the pattern in there? I just dont know how to write the script for it, not really a script guru.



Thank you

0
Comment
Question by:Endelm
2 Comments
 
LVL 85

Accepted Solution

by:
ozo earned 2000 total points
ID: 26171137
#!/bin/bash
read a c
while read b d ; do
  echo "<bla ble bla0=$a  bla1=$b  ble0=$c  ble1=$d>"
  a=$b
  c=$d
done
0
 

Author Comment

by:Endelm
ID: 26173372
Thank you a lot this works. I was trying to add something else to my script, but it has not been working. I will ask this in a new question
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question