1,892 Topics
![]() | |
haven't been using linux for a while. remember I used to do search and replace all the time with :s/searchString/replaceString/g now I have "pattern not found: " even though pattern I was trying to search/replace was definitly there. any idea? did i forget anything? | |
Hi, I am trying to write a Bash Script to sort some images but I am new to Bash and not having any luck. I have a folder of images. Example: P100.jpg P172.jpg P342.jpg P400.png I need to change these filenames to <filename>_DEFAULT<extension>. ie. P100_DEFAULT.jpg and then move the file … | |
I'm baffled by something in a small script I wrote. The purpose of the script is to compare 2 files on a system. Somehow a tree structure was copied and am fairly certain that the files are identical The command line is as follows: /filecomp.sh /home/daniel/Documents/workspace/www/ This is the script: … | |
Hello, I need to seperate multiple domains by having and not having A records. I have created a shell script like below, but it is not working, as the $? is same (0) for both the dig commands that have and not have A records. ************************* #!/bin/bash for dom in … | |
I hope someone can give me some insight into a problem I had. I coded a KORN shell script to read files and change data in them. I read a list of files from a file using a while read. then unzipped the file read each record in a while … | |
I am trying to write a script that will facilitate cataloguing various files on a backup medium. Looking at what's available, only **stat** seems suitable but it outputs the data with a lot of formatting I don't require and would take a lot of scripting to massage into what I … | |
I am trying to run chekstyle on all of my files within a project. So I have model, view, and controller folders all with their subfolders of .h and .cpp files. Is there any way to grab all the files that end in .h or .cpp without having to individually … | |
Hey everyone, I'm pretty unexperienced when it comes to SHELL scripting, and I'm having some issues with something. I'm trying to use a command that lists files within a directory with names that start with “t” or “f” and end with “3” or “2”. After that I will need to … | |
I am new to Powershell and I am trying to get an understanding of it through borrowing script and making it work for my system. I have a script that I thought would take files from a target folder and zip them into a destination folder. It is creating zip … | |
New to bash, I am trying to change the names of dozens of files as I switch over to Linux. I need something that will work recursively from the root of a directory. In my research I found something like this that I have adapted: find /media/D_Drive/Music/ -name '*&*.*' -exec … | |
I am looking for syntax I saw somewhere but can not find now. Working with the results of a find delete the files found. The syntax is something like this: for i in "${find . -name '*.ini'}"; do rm $i; done Am I dreaming or is this possible? | |
I am new to bash shell scripting. Converting over to Linux before support for Windows XP fades into the sunset, I am redesigning and rewriting many scripts that worked using enhanced scripting language Take Command. I am trying to evaluate whether a directory exists based on a list of directories … | |
Been a long time since I've logged in and had a question, but here goes nothing! I have a file that is not delimited in any way, but I need to replace a particular column character from a space to a alphanumeric value on every other line starting at line … | |
Hi, I'm running a script to bring down the logical ip address . But if the system doesnt have that logical ip addresss then i get the following error print on terminal - SIOCSIFFLAGS: Cannot assign requested address I just want to know whether there is a way to suppress … | |
Hey guys, I recently had an assignment to write a sort algorithm we have not yet gone over in class. I had no problem getting my code written and to compile, but now that it compiles I keep getting an error that says "Exception in thread "main" java.lang.NoSuchMethodError: main" I … | |
Hello everyone, I am trying to read in a folder path, delimited by / and ending in COSC, and then output the last field to a file. It is supposed to match all directories that end in a course name, for example, COSC-101 or COSC201. I am using the following … | |
Hi people! I just want to get the sum, max number, average and multiplication of array with n numbers! I already make the sum, but I tried different operators, ways for others and I can't get the another task without errors! Any help! Im really noobie on this Look! #!/bin/bash … | |
I'm doing a program where I need user to enter the name of a text file. I want him to be able to see the path if he enters pwd. Right now this is very OS related and only works on Mac OS(I guess). So I have done string real; … | |
I am new to bash scripting. Is it possible to get a value returned on a nested variable? At the command line, the following code will generate desired ouput: while read line; do echo -e "${line:21}"; done < Albums-linux.txt It takes a list of directories for albums and returns a … | |
Hope my first post is relevant enough. I'm a newbie coder and this is as much a learning exercise as it is a favor for my girlfriend. She has test results from a device that outputs data to .csv in multiple (100+) files. the important data is the separate file … | |
Hi Friends, I need to some help in connecting to webserver using c shell or tcl scripting in linux ie in my office in linux system we have some intranet which is run by tomcat server so i need to connect to that server and read some data existing in … | |
I am writing a simple DHCP server application that gets ip from a server at boot up ! i wrote a shell script to run the java program that obtains ip from server on another machine... The problem is when i have obtained the ip i store it in a … | |
Hi All, I want to pass few dynamic arguments to shell script. The number of arguments differ each time I call the script. I want to print the arguments using the for loop as below. But not working out. for (( i=1; i<=$#; i++ )) do echo $"($i)" done /bin/sh … | |
Hi All, I want to pass few dynamic arguments to shell script. The number of arguments differ each time I call the script. I want to print the arguments using the for loop as below. But not working out. for (( i=1; i<=$#; i++ )) do echo $"($i)" done /bin/sh … | |
Hi I have a file with duplicate records they look something like this: [ICODE]<record> <dateadd>012012</dateadd> <nid>R04607295</nid> <reflink></reflink> <FPI>YES</FPI><TPG>NO</TPG><FT>YES</FT> <num>631</num> <author>Anon</author> <title>ON THE WED</title> </record> <record> <dateadd>012012</dateadd> <idref>R04607297</idref> <reflink></reflink> <type>Article</type> <FPI>YES</FPI><TPG>NO</TPG><FT>YES</FT> <num>651</num> <author>Bent, E</author> <title>ENTRANCES AND EXITS</title> </record> <record> <dateadd>012012</dateadd> <nid>R04607295</nid> <reflink></reflink> <FPI>YES</FPI><TPG>NO</TPG><FT>YES</FT> <num>631</num> <author>Anon</author> <title>ON THE WED</title> </record> <record> <dateadd>012012</dateadd> … | |
Hello everyone, Is been a while since i've been trying to rename a file using the ren batch command, but for some reasons is not working for me. could some one please give me an idea on how to reanme a file with a batch file? Thanks in advance. This … | |
I have written a very simple bash script that runs on Solaris10. It runs a command and then sends me the output via mailx. I can run it at the command line (sudoed as root) and it runs perfectly fine. I then set it up to run from root's cron. … | |
Hey guys, I was doing some basic bash shell script, as I am new to this, and I can't seem to pass over this error. Here is the code: [CODE] #!/bin/bash echo "Please, type in the day of the week." read Day if (($Day="Monday"));then Monday=date +%d Tuesday=$(($Lunes+1)) Wednesday=$(($Martes+1)) Thursday=$(($Miercoles+1)) Friday=$(($Jueves+1)) … | |
Hi, I Want a shell script, when i run it should print the current row & column number of the terminal in which is invoked , so how can i get the current row & column number in the linux . Thanks Srikanth M. | |
I was trying to run a shell script and run it through Cygwin terminal in XP environment. The script I have written is as follows - [CODE]#!/bin/bash read -p "Enter Your name - " fname if test "$fname" == "abcd" then echo "Thank you abcd" fi[/CODE] When I am trying … | |
is it possible to empty all the tables in the database without dropping them with shell script? if yes could you please show me? thank you | |
Well, I hope this is the right forum, first of all. Here's my issue: I have a lot of images stored in subfolders like this example: [I]/Stallone/photos[/I] or [I]/Aguilera/photos[/I]. I'd like to move all the images from the [I]photos[/I] folders one folder up, if possible. I'm hoping maybe there's a … | |
I have a shell script that is outputting from a database. What is coming from the DB is this: ----------- 50 (1 rows affected) The issue that I have is there is an if statement in my script that looks at the first line and reads the number there. Unfortunately … | |
Hi, I want to read a file from the command line and remove all the spaces, tabs in it, replacing it with comma(,), and write it to a new file. can you help me out with this scenario. | |
I'm trying to enter a block of text into an existing configuration file for OpenLDAP so the setup can be fully scripted. The text below is what I want to enter into slapd.conf and this all works well and good, however as you probably know this will place the text … | |
Hi Everyone, I need some help in Tcl Tk Gui Application Development. In that GUI i need 2 drop down lists 1) Subject : , so here a list of subjects will be present 2) Assignment : , So here depending upon the subject again a list of assignments related … | |
Hi, [code] check_time() { fileName=$myFileName newTime=$line newtimeaccess="date --date \"$newTime 6 hour\" '+%Y-%m-%d %H:%M:%S'" newtimeaccess=`echo $newtimeaccess | sh` strnewtime=$(date -d "$newtimeaccess" +%s) systime=$(date +%s) if [ $systime -le $strnewtime ] then return "$fileName__0"; else return "$fileName__1"; fi } value=`check_time "$myFileName $line"` ##$myFileName -- file name and $line -- time of file … | |
Hi All, I'm going crazy with this. I have a file called unique.txt with allot of values in. When I run my script it will add 1 value (1319613308.476855) to my value file but when I grep the value it displays nothing and I know the value is present in … | |
can some body expaly me this command [CODE]sed -e 's/<[^>]*>//g' test > test.t [/CODE] thank you | |
I am trying to write a shell script which will read a file and counts the number of vowels in the file. The code which read the file is as follows - [CODE]while read -n 1 c do l=$(echo $c | tr [:upper:] [:lower:]) [[ "$l" == "a" || "$l" … | |
Hi Everyone, I need a replace a string (ex : this) with the string (ex : that) in each line of a file (sample.txt) using a C Shell Script and I am not allowed to use sed,awk and replace command in the unix , So i tried to use tr … | |
Hi Team, I am new to shell script. Do kindly help me remove junk character from a file having a million records.. As it is production setup do kindly advice Thanks ... Whizkidash | |
Hi, I simply want to append a string at the end of another string. But instead, it is replacing in the beginning. [CODE]#!/bin/bash str1="/user/test" echo $str1 echo ${str1}/program[/CODE] I tried other techniques too but same result | |
Oke so i want to make a script that automaticaly install some apps adds some lines to some files replace some lines from files For the install i use apt-get -y install packagename For adding line im using : [CODE]sudo sh -c 'echo "#Name" >> /etc/apt/sources.list' sudo sh -c 'echo … | |
Hello.. I wrote the following shell script to run disk quotas for assigning limits to users. I need to know the partition which the user has created and mount it. So i copied the partitions (which will be displayed after running fdisk -l) and separted the last line from it … | |
This is the question appeared in our sessional exam related to shell programming What do you mean by $?,$#,$* and $$. Can anyone help me to answer this question? | |
I'm looking for a command or bash script that will create an index.html file in every directory and subdirectory starting at the current directory. I would like it to prompt to overwrite so I don't delete a good index.html file. | |
I have a script file that file type is ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs) Now I want to get the contents of this file. How can I ? Any help me to get cotents of this file type? | |
I post this on C too... Well, my program read all lines from (plain.txt) and save temporary every read strings line by line into another text called(all.txt), i made the md5sum hash on each line separately of (all.txt) and saving this hashes on calculating.txt... then delete the all.txt and calculating.txt, … | |
Can anyone help me with this, please: This code works as intended: [CODE]eval "$(date "+yr=%Y mh=%m dy=%d hr=%H mt=%M sd=%S")" echo "year=$yr ; month=$mh ; day=$dy ; hour=$hr ; minute=$mt ; second=$sd"[/CODE] It gives output [CODE]year=2012 ; month=02 ; day=09 ; hour=14 ; minute=30 ; second=17[/CODE] on stdout. This code … |
The End.