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
114
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
138
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
349
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
142
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
147
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
262
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
164
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
86
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
447
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
369
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
184
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
68
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
175
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
93
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
131
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
160
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
85
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
86
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
89
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
135
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
153
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
92
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
62
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
101
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
75
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
99
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
78
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
110
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
68
Member Avatar for pichels

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 …

Member Avatar for eggi
0
187
Member Avatar for akhil_hello

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 …

Member Avatar for chris5126
0
103
Member Avatar for programmer321

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

Member Avatar for radoulov
0
301
Member Avatar for jedi_ralf

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

Member Avatar for jedi_ralf
0
244
Member Avatar for sandhya03

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 …

Member Avatar for jbennet
0
103
Member Avatar for rppprez

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.

Member Avatar for eggi
0
51
Member Avatar for cyberman111

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

Member Avatar for Impact4ever
0
826
Member Avatar for yasar_ok

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 …

Member Avatar for eggi
0
79
Member Avatar for baku

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 …

Member Avatar for baku
0
92
Member Avatar for krdgopinath

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 …

Member Avatar for eggi
0
94
Member Avatar for ashikin_8119

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 …

0
55
Member Avatar for baku

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.

Member Avatar for baku
0
64
Member Avatar for moazzam

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 …

Member Avatar for eggi
0
89
Member Avatar for cyberman111

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 …

Member Avatar for ithelp
0
117
Member Avatar for ashik_h2k

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 …

Member Avatar for eggi
0
99
Member Avatar for baku

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!

Member Avatar for eggi
0
104
Member Avatar for sjcomp

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 …

Member Avatar for sjcomp
0
104
Member Avatar for skelly16

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 …

Member Avatar for eggi
0
162
Member Avatar for Impact4ever

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 …

Member Avatar for eggi
0
63
Member Avatar for vishwajit

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

Member Avatar for eggi
0
92

The End.