1,978 Topics
![]() | |
first of all, what can i do to make my command works like the "ls, cp, mv" ? I always do vi myScript.sh and then chmod +x myScript.sh and I have to execute it like ./myScript.sh ,,, simply typing $myScript at the command promp will not work. Second question for … | |
I'd like to create a script that will run a command, parse the output for certain fields/words and then email that information to me if it meets simple criteria. For example, when run, the command will output several lines. I'll need to grab the Name: Test1 Type: Windows Active: No … | |
I want to enter a file name and if file name exists, it should print the file else create a new file. Pls help me | |
What command will let me run a script/command on a remote machine? Anything I need to have in place to get this remote execution to work? Thanks! | |
i am trying to synchronize between father process and son process created by fork() command, to print simultaneously. my program is written in c under bash shell. the compile goes ok but when i try to run nothing happens and the program doesnot end. my code is: [CODE] #include <stdio.h> … | |
Hi , Im very new to shell scripting. In our office we use both Linux and Windows platform. We have internet connectivity. The gateway is 192.168.1.1 There is no monitoring tool for us. Im using a Linux machine with fedora 8. I wish to monitor that gateway. I want to … | |
Hi all; Really need your help on writing the shell script based on the condition below. I need to re generate file and display message on the status of the file. I need re-write the file by checking whether the first line starts with '1MBB'. If the first condition fail … | |
display output on one line. this is a exerpt from my kshell script cat <filename> |egrep -v Pattern1|egrep -v Pattern2|egrep -v Pattern3 |egrep -v Pattern3 which displays Name=john, Age=24, Occupation=Sales Name=mike, Age=34, Occupation=Unemployed Name=mike, Age=34, Occupation=Unemployed Name=mike, Age=34, Occupation=Unemployed would like to get em all on one line with or … | |
Hi, I'm going over this topic in unix and i'd be glad if someone could explain this bit of script: [ICODE]sed 's/\(abc\)*/xyz/'[/ICODE] so the input would be [ICODE]abcabcabc[/ICODE] which results in [ICODE]xyz[/ICODE] Also how come 'xyz' doesnt repeat 3 times because the input is 'abc' x 3 ? Thanks in … | |
I am trying to create a simple command menu that runs in a continious loop untill the user enter the exit option. I am recieving a error report that says error on line 10 syntax and unexpected end of file on line 47. Can anyone please help? I have included … | |
Hi all! I am all new to shell scripting. I am trying to make a script that searches for a folder and then adds it to PATH First I am serching for the folder: [CODE]find /usr/local -name "jdk1.6*" -type d[/CODE] If version 1.6 of Suns java is installed I get … | |
I am trying to print a random line from a text file that has 10 lines. The problem that I run into is that it sometimes picks the number "0" which is not a line in the text file. How would I have it pick a random number between 1-10? … | |
hello, I am writing a script to send email to all the users. Can anyone provide the syntax or internet source in reading line from a dir or text document? if users are under /home like: student1 student2 student3 student4 student5 student6 my try is: #!/bin/sh line =`read` while : … | |
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, I am trying to take unix administration and shell scripting courses this summer. I have done 2 courses of C++ and a course of java. However i have never learned C. Anyone please give me some opinion if learning C is necessary for Unix. Since C++ is inherited from … | |
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 … | |
Hi, I need to search a large Directory Path and count all the characters(Even filenames with space and special chars, etc.) in it. Example: /data/general\Customer_Order_Files\Pump_Files\Pump_Open_Files\1217697 METSO MINERALS HITACHI AMERON DUCK CREEK\1217697 MOTOR INFO METSO MIN HITACHI AMER DUCK CREEK 10-3-06\1217697 Motor Quote SIEMENS METSO MIN HIT AMER DUCK CREEK 10-16-06 … | |
Hi, I'm new to shell scripting. Can someone please suggest me some syntax to move files from directory A to directory B using shell scripting. Also the programme should have 2 parameters and based on the parameter values given while executing, the programme should check the file names in directory … | |
[code] Hello, I need to search from a text file all those number from the lines which which lie in the range 1 to 120. Say I have a file with number: 1 2 3 900 1200 so on... I want to only those lines which has numbers in the … | |
I am new to awk, so please excuse any mistakes. I was hoping someone would be able to tell me if it's possible to include variables in a regular expression, and if so, how. The code I currently have is the find the beginning of link (<a) and image (<img) … | |
Hi, I am fetching the record from database using isql in Korn Shell Script. [code] result=isql -U -P -S << EOF select * go EOF` [/code] I got the result. but Iwant result in proper format. i.e [code]field1= field2= field3[/code] I am considering the result as ARRAY and trying to … |
The End.