how to write shell scrit which adds parameters to existing files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to write shell scrit which adds parameters to existing files
# 1  
Old 11-16-2008
how to write shell scrit which adds parameters to existing files

Helo I have one file in that one filed is there

RECLEN: 5

now I want to write a shell script which incresaes the value of RECLEN by 126
as well as I want to write shell script which adds
CURPHONER:2:N:Phone used to call a record on which a recall is set
PHONECNTR:2:N:Number of attemmpts at calling RECALLNUMBER to the existing files

how to write such shell scripts

Regards,
Amit
# 2  
Old 11-16-2008
Quote:
Originally Posted by amitpansuria
Helo I have one file in that one filed is there

RECLEN: 5

now I want to write a shell script which incresaes the value of RECLEN by 126
as well as I want to write shell script which adds
CURPHONER:2:N:Phone used to call a record on which a recall is set
PHONECNTR:2:N:Number of attemmpts at calling RECALLNUMBER to the existing files

how to write such shell scripts

Regards,
Amit
Helo I want to change my problem statement little.

CURPHONER:2:N:Phone used to call a record on which a recall is set
PHONECNTR:2:N:Number of attemmpts at calling RECALLNUMBER to the
to the existing files file1,file2 in one sort and
as well as I want to write a shell script which incresaes the value of RECLEN by 126.

e.g. I have two list1.fdict ,list2.fdict

when I do in my script


echo "CURPHONER:2:N:Phone used to call a record on which a recall is set" >> /opt/avaya/pds/amit/*.fdict

I got following error:

line 5: /opt/avaya/pds/amit/*.fdict: ambiguous redirect

what to do

Regards,
Amit
# 3  
Old 11-16-2008
You can't redirect the line to a selection of files this way. Loop through the files like this:

Code:
for file in /opt/avaya/pds/amit/*.fdict; do
  echo "CURPHONER:2:N:Phone used to call a record on which a recall is set" >> $"file"
done

Regards
# 4  
Old 11-17-2008
Quote:
Originally Posted by Franklin52
You can't redirect the line to a selection of files this way. Loop through the files like this:

Code:
for file in /opt/avaya/pds/amit/*.fdict; do
  echo "CURPHONER:2:N:Phone used to call a record on which a recall is set" >> $"file"
done

Regards
thx for your reply.
Now I want to following lines to .fdict file . also if this line already exist then dont want to add. tell me how to write such effiecient script
CURPHONER:2:N:Phone used to call a record on which a recall is set
PHONECNTR:2:N:Number of attemmpts at calling RECALLNUMBER
PHONESTATR:1:C:PHONESTAT of the current RECALLNUMBER
ZONEPHONER:1:C:Time zone of the current RECALLNUMBER
LASTDATER:10SmilieSmilieate of last attempt on RECALLNUMBER
LASTTIMER:8:T:Time of last attempt on RECALLNUMBER
LASTSTATR:2:C:Stat of last attempt on RECALLNUMBER
FRSTDATER:10SmilieSmilieate of first attempt to call RECALLNUMBER
FRSTTIMER:8:T:Time of first attempt to call RECALLNUMBER
FRSTSTATR:2:C:Stat of first attempt to call RECALLNUMBER
SCNDDATER:10SmilieSmilieate of second attempt to call RECALLNUMBER
SCNDTIMER:8:T:Time of second attempt to call RECALLNUMBER
SCNDSTATR:2:C:Stat of second attempt to call RECALLNUMBER
THRDDATER:10SmilieSmilieate of third attempt to call RECALLNUMBER
THRDTIMER:8:T:Time of third attempt to call RECALLNUMBER
THRDSTATR:2:C:Stat of third attempt to call RECALLNUMBER
FRTHDATER:10SmilieSmilieate of fourth attempt to call RECALLNUMBER



Regards,
Amit
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Write data into existing '.xlsx' file that has multiple sheets

Hello, I have a .xlsx file with 11 worksheets and I need to insert the contents of a text file (tab delim, roughly 30 columns with 1000 rows) from Row 3 onwards on the 2nd sheet. I have my code which can insert values into existing sheet but I am unable to write/import the contents of a text... (1 Reply)
Discussion started by: nans
1 Replies

2. Shell Programming and Scripting

Write data into existing '.xlsx' file that has multiple sheets

Hello, I have a .xlsx file with 11 worksheets and I need to insert the contents of a text file (tab delim, roughly 30 columns with 1000 rows) from Row 3 onwards on the 2nd sheet. I have my code which can insert values into existing sheet but I am unable to write/import the contents of a text... (0 Replies)
Discussion started by: nans
0 Replies

3. Shell Programming and Scripting

my shell now adds extra space at end of each line!

Hi, Since today, with csh or tcsh, if I do 'ls files* > list', every lines end with an extra space! What happenned? What can I do to go back when there was no extra space? If I change to bash, there's no extra space. Thanks, Patrick ---------- Post updated at 03:19 PM... (1 Reply)
Discussion started by: trogne
1 Replies

4. Shell Programming and Scripting

Shell script compare all parameters in two files and display results

Hi , I am not familiar with shell programming. I have a requirement like i have two files .I need to compare the two files by comparing each parameter and i should produce 2 outputs. 1)i have around 35 parameters say i have one parameter name called db_name=dcap in one file and... (7 Replies)
Discussion started by: muraliinfy04
7 Replies

5. Shell Programming and Scripting

how to write a script for existing of IP_add in the files under paticular paths.

Hello , I want to write a script to test the IP_add is hardcoded in the paticular files. the files are available in path . for example. /abs/abn/jkg/frames.sh. like this some files are there in the same path.I manually replaced the IP_ADD with domain name in required files.now i have to... (1 Reply)
Discussion started by: rajkumar_g
1 Replies

6. Shell Programming and Scripting

How to write a shell script to display files in single path?

Hello friends, I am a script which dispalys a multiple files with their contents. for exm: suppose two file test1.txt and test2.txt. when I run my script it have to display the below O/P. test1.txt -rw-r----- 1 sranga staff 91 Sep 23 02:18 calc.sh -rw-r----- 1 sranga ... (2 Replies)
Discussion started by: sivaranga001
2 Replies

7. UNIX for Dummies Questions & Answers

Create a shell script for write files with 2 parameters

Hello, I'm a newbie in shell script. So, i would like to create a shell script which take 2 IN parameters (PARAM1 and PARAM2). This script need to create 2 files as : I need to create this file /etc/apache2/sites-available/PARAM2 : <VirtualHost *:80> DocumentRoot "/home/PARAM1/www"... (0 Replies)
Discussion started by: chatlumo
0 Replies

8. Shell Programming and Scripting

shell script to remove old files and write to a log file

Hi, I have a script that works on a unix box but am trying to get it working on a linux box that uses shell. I am not a programmer so this is proving harder than I imagined. I made some changes and ended up with the script below but when I run it I get the following messages. Any help would be... (4 Replies)
Discussion started by: yabai
4 Replies

9. UNIX for Dummies Questions & Answers

write new line at the beginning of an existing file

I was trying to find out the easiest way to write new line to the beginning of an exisiting file. I am using KSH. (5 Replies)
Discussion started by: sailussr
5 Replies

10. Shell Programming and Scripting

shell script that adds two integers and display answer on screen

please help shell script that adds two intergers and display answer on screen (1 Reply)
Discussion started by: wanyac2
1 Replies
Login or Register to Ask a Question