change only selected line


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers change only selected line
# 1  
Old 04-13-2006
change only selected line

hi

i dont know how to go abt this? as i m new to unix.
i have file say as xct. in file there are so many commands.
[ frankly its crontab file]. now here i m accepting new cron settings from user.

but these new settings will be applicable for particular command.
like my file is as
* * * * * read a < /aaadatamart/training/swapneel/util/cronsettings && [ $a -eq 1 ] && ksh /aaadatamart/training/swapneel/util
/hi

* * * * * read a < /aaadatamart/training/swapneel/util/cronsettings && [ $a -eq 2 ] && ksh /aaadatamart/training/swapneel/util
/hi1

* * * * * read a < /aaadatamart/training/swapneel/util/cronsettings && [ $a -eq 3 ] && ksh /aaadatamart/training/swapneel/util
/hi2


Now here first i will ask user choice -- [ say hi2]

then i will ask user abt new minute,date,... cron settings.
then those settings i want to add to this line so my crontab file with the new settings as per the user new input for selected choice [hi2]

plz guide me how go abt this. any logic or atleast any clue?

thanks in advance

regards,
swapneel


here i know how to edit cron file.
crontab < filename.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed to delete selected line from file

Ultimate goal is to delete lines from before and after a block of lines in a given file. First attempt was something like this: sed -e '1,/STARTUP/ d' inputfile.txt > outputfile.txt but that deleted everything down to and including the line with STARTUP. I need to delete everything before... (6 Replies)
Discussion started by: edstevens
6 Replies

2. Shell Programming and Scripting

change to one line for if then if then

if ! grep -q "aa" $line;then if ! grep -q "bb" $line;then somthing fi fi (2 Replies)
Discussion started by: yanglei_fage
2 Replies

3. Shell Programming and Scripting

Getting contents of line using a selected one as reference

How do you get the contents of a line directly after a selected one? Also, how about before it? I am using CSH and don't have any GNU products installed. Input file: apple orange plum So say I use grep on orange...how do I get plum (this line can be different so I can't just grep... (4 Replies)
Discussion started by: thibodc
4 Replies

4. UNIX Desktop Questions & Answers

change in line

i have a line that has ",,", i need to change it to "," ; But i have it more than one time in the same line , sub(",,",",",$0) just sub the first one in the line? ---------- Post updated at 08:15 AM ---------- Previous update was at 08:15 AM ---------- using AWK please (2 Replies)
Discussion started by: Reham.Donia
2 Replies

5. Shell Programming and Scripting

Compare selected columns of two files and print whole line with mismatch

hi! i researched about comparing two columns here and got an answer. but after examining my two files, i found out that the first columns of the two files are not unique with each other. all i want to compare is the 2nd and 3rd column. FILE 1: ABS 456 315 EBS 923 163 JYQ3 654 237 FILE 2:... (1 Reply)
Discussion started by: engr.jay
1 Replies

6. Shell Programming and Scripting

Delete a line between selected lines using sed or any other command

I want to delete a line between selected lines using sed: e.g. : Between "bus" to "pins", delete lines conaining "signal" word. Input : bus direction signal new signal old pins signal ok end Desired Output: bus direction pins signal end (4 Replies)
Discussion started by: nehashine
4 Replies

7. Shell Programming and Scripting

change line

Hello, I want to change a line at file whit a script i want to change line 150 for example, write hello and remove text of this line EXAMPLE LINE 150: my mother change to: LiNE 150: HELLO (4 Replies)
Discussion started by: uri_crack
4 Replies

8. Shell Programming and Scripting

trying to print selected fields of selected lines by AWK

I am trying to print 1st, 2nd, 13th and 14th fields of a file of line numbers from 29 to 10029. I dont know how to put this in one code. Currently I am removing the selected lines by awk 'NR==29,NR==10029' File1 > File2 and then doing awk '{print $1, $2, $13, $14}' File2 > File3 Can... (3 Replies)
Discussion started by: ananyob
3 Replies

9. Shell Programming and Scripting

SED: Place char at starting and replace selected line

Hello Experts, I am working on a small file editing script. Since all experts here are very generous to give me the complete code, I would take up the problem in steps so that I ensure my opportunity to learn. AIM: The script has some commented and some uncommented lines. I need to : ... (2 Replies)
Discussion started by: hkansal
2 Replies

10. Shell Programming and Scripting

Script to change file contents line by line

Hi, I'm struggling to write a script to do the following, -will go through each line in the file -in a specific character positions, changes the value to a new value -These character positions are fixed througout the file ----------------------- e.g.: file1.sh will have the following 3... (4 Replies)
Discussion started by: vini99
4 Replies
Login or Register to Ask a Question
CRON(8) 						      System Manager's Manual							   CRON(8)

NAME
cron - clock daemon SYNOPSIS
/usr/sbin/cron DESCRIPTION
Cron executes commands at specified dates and times according to the instructions in the files /etc/crontab and /etc/crontab.local. None, either one, or both of these files may be present. Since cron never exits, it should only be executed once. This is best done by running cron from the initialization process through the file /etc/rc; see init(8). The crontab files consist of lines of seven fields each. The fields are separated by spaces or tabs. The first five are integer patterns to specify: o minute (0-59) o hour (0-23) o day of the month (1-31) o month of the year (1-12) o day of the week (1-7 with 1 = Monday) Each of these patterns may contain: o a number in the range above o two numbers separated by a minus meaning a range inclusive o a list of numbers separated by commas meaning any of the numbers o an asterisk meaning all legal values The sixth field is a user name: the command will be run with that user's uid and permissions. The seventh field consists of all the text on a line following the sixth field, including spaces and tabs; this text is treated as a command which is executed by the Shell at the specified times. A percent character (``%'') in this field is translated to a new-line character. Both crontab files are checked by cron every minute, on the minute. FILES
/etc/crontab /etc/crontab.local 7th Edition October 23, 1996 CRON(8)