Visit Our UNIX and Linux User Community


Copy data and send it to other file, with diff config


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copy data and send it to other file, with diff config
# 1  
Old 01-29-2008
Tools Copy data and send it to other file, with diff config

I need a new script to 'grep' data from files in var
and send it to another file in var folder with diff output,
but like you now my Now How is very, very small then to have a idea is something like this:


in file text1.txt have a few lines like this one:
Code:
Y: { XXX1 { XXX2 YYYY { IIIIIIII { AA BB }}}}

Variavel:
XXX1
XXX2
YYYY
IIIIIIII
AA
BB

and I whant to send it to file text2.txt
with this output:

G: 88888888 LLLLLLL 55555 IIIIIIII XXX1 YYYY

where 88888888 LLLLLLL 55555, is in all the lines the same and i need to add Y lines but
only the variavel's IIIIIIII XXX1 YYYY in G lines.




File text1.txt is in folder /var/ and text2.txt is in folder /var/ to.

I need also to read conf file with data and send it to diferent files, like:

my.conf
Code:
Data:
==============
SERVER_PORT=20000 send it to ports.cfg in var like this:
SERVER PORT : 20000
USER=root send it to ports.cfg in var like this:
USERNAME : root
PASS=pass send it to ports.cfg in var like this:
PASS : pass
Port=16000 send it to portsall.cfg in var like this:
Port          = 16000
==============
Device= XXXXXX 
PortDevice1=16000 send it to portsall.cfg in var like this: 
Device           = XXXXX,16000
==============
UDP_HOST=192.168.1.110
TCP_HOST=192.168.1.110
UDP_PORT=1000
TCP_PORT=3001  send it to config.xml in var like this:

<udp_host>192.168.1.110</udp_host>
<tcp_host>192.168.1.110</tcp_host>
<udp_port>1000</udp_port>
<tcp_port>3001</tcp_port>

In text1.txt I have Z line too and i need to add to conf to
Code:
zebrareport=0110
zebraip=10.0.0.2
zebraudpport=8024 and send it to text1.txt in var like this:

Z: { 01 10 } 10.0.0.2 8024


Well if you help me with this i will very happy, Thank's. Smilie

Note: Froget in files there is coments "#", this is not to display or show, then ignore coments.
Sorry for my english... Smilie
I think i explained well but any question i will try to explained better...

Previous Thread | Next Thread
Test Your Knowledge in Computers #343
Difficulty: Medium
Scott McNealy, Andy Bechtolsheim, and Vinod Khosla, all Caltech graduate students, founded Sun Microsystems.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to create folder, copy file, and send email on success

I am very new to UNIX as well as scripting so please be gentle, haha. I have a Linux client which has a mount point mapped to my /etc folder on a NetApp FAS system. I woudl like to be able to copy the hosts and rc files once a week from the FAS to a different location for backup. When the... (4 Replies)
Discussion started by: minnino
4 Replies

2. Shell Programming and Scripting

Read Data from Config file using Perl

Hi All, Can anyone please explain me how to read data from config file in Perl. Suppose i have a config file named cfile. The data in config file is name=parth lname=mittal user=2007 hostname=fluoride username=parthmittal password=XXXXXX account=unix url=www.unix.com ... (2 Replies)
Discussion started by: parthmittal2007
2 Replies

3. UNIX and Linux Applications

how to send config file to other application

hi.. i have one c++ pgm which run shell script.shell script reads username and password from file.This pgm check username password is correct or not.After checking this i want to send config file of respective user to other application.I made config file also.My problem is how to send this... (1 Reply)
Discussion started by: shubhig15
1 Replies

4. Shell Programming and Scripting

how to send config file to other application

hi.. i have one c++ pgm which run shell script.shell script reads username and password from file.This pgm check username password is correct or not.After checking this i want to send config file of respective user to other application.I made config file also.My problem is how to send this config... (1 Reply)
Discussion started by: shubhig15
1 Replies

5. UNIX and Linux Applications

how to send config file

hi all please give me some idea about how to send xml file from one c++ pgm to other pgm. (1 Reply)
Discussion started by: shubhig15
1 Replies

6. Shell Programming and Scripting

how to send config file

hi all please give me some idea about how to send xml file from one c++ pgm to other pgm. (1 Reply)
Discussion started by: shubhig15
1 Replies

7. Shell Programming and Scripting

Parse config file data to script variable

I have a script with few pre defined variables. Also have a config file. Something like this. # config file # Define Oracle User MOD1_TAG=abcde MOD2_TAG=xyzabc MOD3_TAG=def I need to parse the config file and have each of the value copied to different variables. Please suggest what... (1 Reply)
Discussion started by: souryadipta
1 Replies

8. Shell Programming and Scripting

Extracting data from text file based on configuration set in config file

Hi , a:) i have configuration file with pattren <Range start no>,<Range end no>,<type of records to be extracted from the data file>,<name of the file to store output> eg: myfile.confg 9899000000,9899999999,DATA,b.dat 9899000000,9899999999,SMS,a.dat b:) Stucture of my data file is... (3 Replies)
Discussion started by: suparnbector
3 Replies

9. UNIX for Advanced & Expert Users

copy diff files

I have to synchronize files on two machines, but these are not connected via LAN. Now I'm using DVD's to copy new data. The question is how can I create a list of files on one machine and having this list archive or copy only new files from other. Are there any standard tools like diff/patch for... (3 Replies)
Discussion started by: Hitori
3 Replies

10. Shell Programming and Scripting

getting data from config file

pls help.. I need to get the ESSID value for athx this is the config file.. pls help (7 Replies)
Discussion started by: esham
7 Replies

Featured Tech Videos