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 … | |
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 … | |
is it possible to create a script in windows to automatic email you if nessesary and if so what would be the best way to go about it. | |
Hi I am trying to write a script that converts centigrade to fahrenheit and vice versa I need to use a sub-function to perform the calculations. Can anyone help me get started on this I am kinda lost and will like help learning this thank you | |
Hi All, In my network setup all our UNIX/Linux Servers are standalone.So when a user joins i have to create a user account in all the servers. I will be using the same user acc to create the user account across servers So if you can guys provide me a … | |
I have two program problems: a program that generates this file writing zeros for PID and TIME and random numbers in the 8 pozitions of the DATA field. and program that will create at least 3 child processes, each of which will repeat at least 10 times the following operations … | |
Hi Everyone, I have the data like below in CSV file Column1,Column2 A,3 A A,4 A L,5 AIM,6 If i sort the above mentioned date in excel, here is the sorted output: Column1,Column2 A,3 A A,4 A L,5 AIM,6 But if i tried to sort above data by using Sort … | |
Hi all; I have a file that i need to sort and batch with certain criterias. For every 5 lines that meet the criteria i need to add '1' above it to separate it with other batch. The original file look like this: 20080201A300000357701 80058+117.06 02 20080201A300000357701 80058-117.06 02 20080201A300000382309 … | |
I need some ideas: The called program gets as parameters two or more integers and and returns 0 if all pairs of two are relatively primes, and 1otherwise. The callee shall read a sequence of numbers and tell whether they two by tworelatively primes. | |
I am using solrais 10 on sun sparc. The following command executes successfully echo c:/test.txt | sed -e 's/\//\\\//g' But when i executes the following command x=`echo c:/test.txt | sed -e 's/\//\\\//g'` I get the following error [B]sed: command garbled: s/\//\\//g[/B] Is there any way to avoid this error. I … | |
HELLO i HAVE A SCRIPT THAT TAKES INFORMATION FROM 2 FILES AND PUT IT IN ONE, NOW I NEED TO PUT ALL THE INFORMATION(OUTPUT) INTO A NEW FILE , THIS IS HAS TO BE DONE IN THE ORIGINAL SCRIPT NOT COMMAND LINE, CAN ANYONE TELL ME HOW TO DO THIS … | |
Hi, A tool is run just by the command "adutool" from anypath inside the same server. This command will execute the script in the folder "/myfolder/bin/adutool" on the same server. Since "/myfolder/bin/" is setenv'd in the PATH env variable, it runs the tool. Now my question.. Is there anyway of … | |
Being given a text file create a folder that will contain 26 dictionary files as follows:first file contains the words begining with 'A', alphabetically sorted, the second file with 'B' and so on. The way I tried to solve it is attached...pls help! | |
Hello, I have a project that I can build with a script. I'd like to add version number + release number to my builds. I'm looking for a way to do it automatically. As a result I'd like to get something like that: [inlinecode]\deployment\v1.2.3\some.exe[/inlinecode] When I run exe I'd like … | |
HI All I have a script which counts how many times a job has failed. For some reason my echo $list wont work in a variable, it works if i dont put it in a variable, but i need this in a variable so i can do a grep -c … | |
Hey I need some with help this... I'm writing a script that will display, "date and time, how much memory and HD is used, plus display the type of processor info and temperature of the CPU". Then redirect the output back into the script. I found everything what the teacher … | |
Hi Can anyone help on how to add passwords to already created users non-interactively in shell script. Passwords will be stored in one text file. Script should automatically take passwords from file. Thanks in Advance Vishwajit |
The End.