1,891 Topics
| |
I have a problem in the following code ... while read line do #Get Line Number OLDLINE=`sed -n $Lineno $filename` echo "Un Changed Line : "$OLDLINE echo "Enter a New Pattern : " read NewPattern <&1 echo "NewPattern :"$NewPattern NEWLINE=`cat $filename | sed -n $Lineno | sed s/$OldPattern/$NewPattern/` echo $NEWLINE … | |
What four ways can you specify the current directory in your PATH? for sh This is a question that I couldn't get it right. I thought pwd is one of the way but it wasn't. can anyone help? thanks | |
Hello All, How to replace a string in nth line of a file using sed or awk. For Ex: test.txt Line 1 : TEST1 TEST2 TEST3 Line 2 : TEST1 TEST2 TEST3 TEST4 Line 3 : TEST1 TEST2 TEST3 TEST5 Line 4 : TEST1 TEST2 TEST3 TEST6 Line 5 : … | |
can anyone tell me how I can print the first or the last character from a sh file ? i have done research on regular expression and the grep... i couldn't find any cmd that i can use to achieve this task. Thanks a lot. | |
Dear All, thanks in advance for helping me.... plz can anyone provide the url for the basic tutorials to practice the linux shell script?????? With regards, S.Rajesh | |
Hello, I have script to gather total FS usage size. I use to list of the FS's in another notepad file and this script will read from that file. finally it will give me output of total allocated space, used space, available space and percentage of space. This script works … | |
I know I can do " sed 's/old/new/g' filename to make the change to standard output.... however, is there a way that it would save the change to the file instead of just showing to the screen? Another question on ed, i know i can search by using /target/ , … | |
| how can i have a automatically check folder size and when the contain of the folder is reach to some limit it will deletes all the contains the files inside. |
I am currently taking shell scripting online, my professor has emphasized again and again not to use csh. I haven't learn in depth the difference between csh and sh yet. Can anyone explain abit what is the major difference? a little example please if possible.. thanks | |
Hi, Following is my code : i=3 j=3 while [ $i -le $count1 ] do i=`expr $i + 3` head -n 60 file1.imp >> s27.txt [COLOR="Red"]while [ $j -le 60 ] [/COLOR] do head -n 3 file2.imp >> s27.imp ./prog1 s27.txt > result.txt if grep OUT result.txt then head -n … | |
The server should be called as follows: # ./bashwebserver.sh port [root] Where port is a mandatory argument to specify the port number the server should listen on, and root is an optional argument to specify the web server's root directory. P.S: ● If the root directory is not specified, use … | |
Is there any way to check the first $NUM chars of a variable? For example if I have a veriable which contains VAR="LONGMORE LTD" Can i check the first character begins with L? | |
Hello all, I am not at all by no means a good scripter, I just started last week... I am using Nagios and need to write a script using wget to pull webpages and test the response time. I need to write a script that pull the response time from … | |
would anyone please tell me how i cp the whole directory to another directory without the originalDir name.... ex: say the original contains multiple directory contains multiple directory.. and files how do i copy everything from one directory to another directory i tried cp -r /home/henry/originalDir /home/henry/newDirectory..... however my newDirectory … | |
Hi Guys, I am self studying BASH, and will really appreciate it if you could share a list of typical assignments, especially if you can rate them from easy to hard. Just want to practice, and I have already scripted everything I needed to on my servers :) Thanks | |
i used vi: %vi shellProgramming and then i typed the shell script in the vi and saved with :wq However, when i run the vi file ...... %shellProgramming my unix says "command not found" why is that? and how do i run the vi shell scripting file? thanks | |
Hello I have the following in a variable called TEST echo $TEST result : STEPHEN LTD What i want to do is find out whether there are any spaces in my variable name, and if so do the following STEPHEN%42LTD bascially put a %42 where the space is....any ideas? | |
Hi, I wish to delete the last three lines of a file iteratively. I tried this in unix shell scripting but it is not working.. lines=$(wc -l < s27.cnf) target=$((lines-2)) sed '$target,$lines d' s27.cnf > f2.cnf mv f2.cnf s27.cnf I am getting an error "sed: 1: "$target,$lines d": undefined label … | |
can anybody please give some quick reference in how to insert characters or line of characters to a file... and how to exit the insert mode in the regular expression. ex: ed try.txt 1,$p -->prints everything how do i get in to the insert mode ? " i " ??? … | |
Hi, What is the difference between using exit 0 and exit (0) in the shell script? Thanks Saurya | |
Hi I want to grep for a line and copy and paste that line. for Example ---- file abc.txt ---- host=atlx1 sid=atld1 mail=abc@abc.com host=atlx2 sid=atld2 mail=xyz@abc.com host=atlx3 sid=atld3 mail=def@abc.com host=atlx4 sid=atld4 mail=mno@abc.com --- end of file abc.txt ---- Now I want to grep line with host=atlx3 and sid=atld3 and copy … | |
Anyone know of a good shell script beautifier that works in either unix or windows or a way of properly indenting/tidying up code??? | |
Hi, I have written a script file that first makes a ssh connection with the remote system and then does some job. My script file is as follows [code] #! /bin/sh ssh 172.16.1.2 <<EOF sa=`/usr/sbin/alternatives --config java </root/Desktop/1.txt 2>&1 | grep jdk1.6.0_05` echo $sa sa2=`echo $sa | sed -e 's/[^0-9]//g'` … | |
Hi I have written a script file which uses whiptail --inputbox to get an input and i want to execute this script from a java program... my java code is [code] Process process = Runtime.getRuntime().exec("/path/../myscript.sh"); [/code] but when i run my java code the script is not running. The whiptail … | |
can pliz someone help, m trying to serach and display a record in shell scripting in linux i have one data file n one source file. wat should write in the source[coding] file to to search for a record acording to a search pattern entered by a user... the data … | |
I have the following file 1928282,Stephen LTD,31280938,L34 3128398,Stephen LTD,84327489,L34 I want to uniq on fields 2 & 4, the fields are comma seperated I cant figure out how to do this....any ideas? im pretty sure uniq does not support this | |
I am having a problem. I am trying to print the copyright symbol using echo command. But the copyright symbol should be placed in an xml tag. For instance this is my shell script code echo "<string>""3.15," © "Copyright 2008 My company Inc. All rights reserved.""</string>" when i copy this … | |
Hi I want to give input automatically by some means... that is i wanna write a script that checks the type of java being installed in the system and should select the appropriate one (for eg, sun's java) [code] /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.5.0_14/bin/java 2 [/code] usually this command shows … | |
Hi, Am new to scripting. :) Am trying to figure out whether can i use bash scripting to parse an xml file. Parsing is not just pulling out information according to the pattern but its more of a generic parsing. I should identify the xml hierarchy and pull of information. … | |
Hi, I have this belowmentioned file: col1 col2 10 50 20 60 30 70 40 80 I have to take the O/P as col1 col2 col3 10 50 60 20 60 80 30 70 100 40 80 120 Using awk how can i get the above output as the col3 … |
The End.