updating a single line by script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting updating a single line by script
# 8  
Old 10-18-2010
MySQL

I konw that one,
I added the mode to the script and right now it works perfectly...
Thanks again..
# 9  
Old 10-18-2010
Otherwise, without the execute permission but with read permission you can

Code:
ksh original.sh

by the way if you put
Code:
#!/usr/bin/ksh

as a first line, it might be a good idea to name it
Code:
original.ksh

instead ...

Last edited by ctsgnb; 10-18-2010 at 08:23 PM..
# 10  
Old 10-19-2010
Lightbulb

Thank again,

What should i do if I want to to remove the #, I have tried coule of things on the sed you've told me, however it didnt work.


Now if I have sth like

echo "a"
#echo"b"
echo "c"



when I tried I ended up deleting everything until the word I've searched;

echo "a"
b"
echo "c"

but I want to have

echo "a"
echo"b"
echo "c"
# 11  
Old 10-19-2010
Code:
mv yourfile yourfile.old
sed 's/#\(.*\)/\1/' yourfile.old >yourfile
rm yourfile.old


Last edited by ctsgnb; 10-19-2010 at 09:37 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Merge multi-lines into one single line using shell script or Linux command

Hi, Can anyone help me for merge the following multi-line log which beginning with a " and line ending with ": into one line. *****Original Log***** 087;2008-12-06;084403;"mc;;SYHLR6AP1D\LNZW;AD-703;1;12475;SYHLR6AP1B;1.1.1.1;0000000062;HGPDI:MSISDN=12345678,APNID=1,EQOSID=365;... (3 Replies)
Discussion started by: rajeshlinux2010
3 Replies

2. Shell Programming and Scripting

Updating value from new last line of tempfile

Heyas A variable within a loop doesnt get updated - eventhough the 'inputfile' changes. I have a tempfile ($TMP.playstatus), which contains this data: 0.11 M-A: 0.000 fd= 0 aq= 4KB vq= 0KB sq= 0B f=0/0 0.14 M-A: 0.000 fd= 0 aq= 4KB vq= 0KB sq= 0B f=0/0 ... (13 Replies)
Discussion started by: sea
13 Replies

3. Shell Programming and Scripting

Shell script - Replace just part of a single line in a file.....

Hey guy's.... I new here, But im working on a school project, and I am not really good at programming. In fact, this is the only programming class that I need because programming is not what I am majoring in. But I have everything done in this shell script except for this last part..... ... (9 Replies)
Discussion started by: hxdrummerxc
9 Replies

4. Shell Programming and Scripting

editing single line in html file in perl script

Hi Folks, It is regarding the perl scripting. I have an html file(many files) which contains the below line in the body tag. <body> <P><STRONG><FONT face="comic sans ms,cursive,sans-serif"><EM>Hello</EM></FONT></STRONG></P> </body> Now I want to read that html file through perl... (3 Replies)
Discussion started by: giridhar276
3 Replies

5. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

6. Shell Programming and Scripting

Single/Multiple Line with Special characters - Find & Replace in Unix Script

Hi, I am creating a script to do a find and replace single/multiple lines in a file with any number of lines. I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE print $FIND gives Hi How r $u Rahul() Note:... (0 Replies)
Discussion started by: r_sarnayak
0 Replies

7. Shell Programming and Scripting

awk, perl Script for processing a single line text file

I need a script to process a huge single line text file: The sample of the text is: "forward_inline_item": "Inline", "options_region_Australia": "Australia", "server_event_err_msg": "There was an error attempting to save", "Token": "Yes", "family": "Family","pwd_login_tab": "Enter Your... (1 Reply)
Discussion started by: hmsadiq
1 Replies

8. Shell Programming and Scripting

bash script execution with a variable in a single line

Let a script needs a variable to execute. For example if i run ./test.sh then it needs a variable as there is a <STDIN> in the script. I want to execute it as in command line. Let test.sh requires a variable name $number I want to execute it by >test number <enter> how is it possible? (1 Reply)
Discussion started by: shoeb
1 Replies

9. Shell Programming and Scripting

Script to add a single line to middle of text file.

I've got a configuration file that is filled with xml text statements for example: <...../> <...../> <...../> <data id="java-options" value="-server -Djava.security.policy..../> <...../> <...../> <...../> I want to write a korn shell script that will go to this specific line and add a... (2 Replies)
Discussion started by: progkcp
2 Replies

10. Shell Programming and Scripting

Script needs to be modified - Each 5 Rows to be joined in single line with comma (,)

Hi All, I'm using the following script to produce a result: #!/bin/sh awk ' $0 ~ /\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+Interface\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+/ { match_str="YES"; line_cnt=0; next; } { if((line_cnt < 5) && ( match_str=="YES")) { print $0; line_cnt += 1; } else... (0 Replies)
Discussion started by: ntgobinath
0 Replies
Login or Register to Ask a Question