1,891 Topics

Member Avatar for
Member Avatar for maxmave

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 …

Member Avatar for omrsafetyo
0
112
Member Avatar for k2k

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

Member Avatar for omrsafetyo
0
137
Member Avatar for maxmave

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 : …

Member Avatar for ghostdog74
0
336
Member Avatar for k2k

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.

Member Avatar for ghostdog74
0
140
Member Avatar for rajdani

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

Member Avatar for masijade
0
145
Member Avatar for rpnalluri

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 …

Member Avatar for rpnalluri
0
252
Member Avatar for k2k

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/ , …

Member Avatar for Salem
0
161
Member Avatar for conandor

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.

Member Avatar for conandor
0
85
Member Avatar for k2k

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

Member Avatar for Salem
0
421
Member Avatar for guest7

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 …

Member Avatar for eggi
0
367
Member Avatar for tanha

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 …

Member Avatar for eggi
0
179
Member Avatar for sjgriffiths

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?

Member Avatar for eggi
0
65
Member Avatar for geofoxer

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 …

Member Avatar for eggi
0
172
Member Avatar for k2k

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 …

Member Avatar for Salem
0
90
Member Avatar for DimaYasny

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

Member Avatar for eggi
0
127
Member Avatar for k2k

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

Member Avatar for eggi
0
154
Member Avatar for sjgriffiths

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?

Member Avatar for DimaYasny
0
82
Member Avatar for guest7

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 …

Member Avatar for eggi
0
83
Member Avatar for k2k

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 " ??? …

Member Avatar for eggi
0
85
Member Avatar for saurya1979

Hi, What is the difference between using exit 0 and exit (0) in the shell script? Thanks Saurya

Member Avatar for eggi
0
132
Member Avatar for upsrk

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 …

Member Avatar for blater
0
103
Member Avatar for chris5126

Anyone know of a good shell script beautifier that works in either unix or windows or a way of properly indenting/tidying up code???

Member Avatar for chris5126
0
147
Member Avatar for Raghavansat

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'` …

Member Avatar for blater
0
90
Member Avatar for Raghavansat

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 …

0
61
Member Avatar for vinz4ever

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 …

Member Avatar for Salem
0
99
Member Avatar for sjgriffiths

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

Member Avatar for eggi
0
72
Member Avatar for Mithun.kamath

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 …

Member Avatar for anotheruser
0
97
Member Avatar for Raghavansat

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 …

Member Avatar for eggi
0
77
Member Avatar for karthikvela

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. …

Member Avatar for eggi
0
107
Member Avatar for manuswami

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 …

Member Avatar for Salem
0
66

The End.