1,978 Topics

Member Avatar for
Member Avatar for landog

[code] #!/bin/bash if [ [ $a == $b + $c ] || [ $b == $a + $c ] || [ $c == $a + $b ] ]; then [/code] result: too many arguments What is the proper syntax? Thanks!

Member Avatar for laksh.ss
0
168
Member Avatar for dave_nithis

Hi all, I have two files namely a.txt b.txt a.txt contains 100 records and b.txt contains 9 records.These 9 records in b.txt is also present in a.txt.So,I need a script that compares these two files and outputs the unique 91 records alone in another file. Thanks to all in advance!!!! …

Member Avatar for laksh.ss
1
116
Member Avatar for bimaljr

Hi I want to resize all my photos but there are so many subfolders too and every subfolder contents JPG files. Now, I want to resize all my main and sub folder's JPG files with HIGEST CLEARITY. I know that there is "convert" command but it only do inside one …

Member Avatar for programmerpro
0
194
Member Avatar for farawaydsky

Hi, I have a requirement where I have to identify duplicates from a file based on the first 6 chars (It is fixed width file of 12 chars length) and whenever a duplicate row is found, its original and duplicate row's last 2 chars should be updated to all 0's …

Member Avatar for L7Sqr
0
115
Member Avatar for sanju456

[COLOR=DarkSlateBlue]Hi all, Problem: Send mail is configured in my system and now i want to write a shell script using which i can send mail to my rediffmail account. Its little urgent & i will be very thankful if someone send me the code. regards, Sanjeev Kumar(sanju456@rediffmail.com)[/COLOR]

Member Avatar for sftranna
0
2K
Member Avatar for Mayank Mathur

what command to use if i want to use both "from:" & "To:" field in same e-mail in Linux mail() supports subject , not "from" Sendmail() supports "from", not "subject" regards Mayank

Member Avatar for sftranna
0
625
Member Avatar for iamthesgt

For a shell script used to automatically generate c++ code files, I have to split certain names apart for them to be formatted. I split them at a capital letter, but I do not want to split if there are multiple capital letters in sequence. For example: I want this …

Member Avatar for iamthesgt
0
2K
Member Avatar for jereik

Got this error while trying to compile the code below: "Floating point exception" [code] #Create a simulator object set ns [new Simulator] #Open the nam trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace #Close the …

Member Avatar for timetrex
0
229
Member Avatar for woodson2

I currently use this message to send e-mails in a script but I would also like to save the output of this code to a file as well while preserving the variables. What's the easiest way to accomplish this? when=`/bin/date` /usr/sbin/sendmail -t >2 <<-EOM Subject:User access disabled. From:testuser@test.com To:$EMAIL User …

Member Avatar for griswolf
0
106
Member Avatar for dwlamb

A script I am writing on works on the DVD present in the drive at time of script execution. I want to extract merely the label of whatever appears after '/media/'; ./script.sh /media/DVDRW-43/ An obvious solution would be to get the substring by `path='echo ${file:7:9}' #renders DVDRW-43` but I would …

Member Avatar for cheochi
0
182
Member Avatar for iamthesgt

I am using Awk inside a bash shell script to search header files for c++ functions so I can add these functions to another file. All of the functions I need will have form: type getName() or type setName(type value) Right now I get all the functions listed in between …

Member Avatar for iamthesgt
0
454
Member Avatar for rishabhjain

I am designing a text translator in which I have to replace a array of string to another string : Illustration: cmptr is an elctrnc mchn It should be translated to : computer is an electronic machine. (Irrespective of the case-senitivity) Can anyone help me?

Member Avatar for chris.stout
0
94
Member Avatar for John Linux

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 …

Member Avatar for KenJackson
0
238
Member Avatar for ampak

I have a command lline script that works perfectly. cat <some_filename> | awk '$9 == 200' | awk '$10 == 10623720' | awk -F\" '{print $6}' | sort | uniq -c | sort -r I want to put this in a shell script so that we do this for multiple …

Member Avatar for KenJackson
0
233
Member Avatar for nikita.

CONFIG_FILE="${HOME}/sample/seq.cfg" count=`awk 'END {print NR}' $CONFIG_FILE` echo $count t=1 while [ "$t" -le "$count" ] do output_var=`awk -v v1=$t '$1 ~ /v1/ { print $1 }' $CONFIG_FILE` input_var=`awk -v v1=$t '$1 ~ /v1/ { print $3 }' $CONFIG_FILE` echo "O=" $output_var echo "I=" $input_var done the above code is giving …

Member Avatar for nikita.
0
255
Member Avatar for Baduizm

I need a simple script to echo current date 600 times once every second redirect it to a text file and follow the file as it grows using a tail command.

Member Avatar for JeoSaurus
0
174
Member Avatar for matharoo

-53 45 -54 43 -55 42 -56 41 -57 40 -59 37 -61 35 -61 36 -62 34 -64 33 -65 31 -65 32 -67 30 -68 29 -69 28 -72 25 -73 23 -73 24 -74 22 -76 20 -76 22 -78 20 -79 18 -80 17 -81 16 …

Member Avatar for b1izzard
0
254
Member Avatar for spawn2004

Hi all I have a little problem with bourne shell. I've just started writing that kind of scripts I have to write a script that search in folder for header.txt, footer. and content.txt. If these files exists i have to copy the content from them (ignoring the lines with #) …

Member Avatar for spawn2004
0
120
Member Avatar for esraa waqfi

i wanna ask how to read from a file and give a summery of letter count (separate small than capital letters),number of line ,number of paragraphs,number of quoted sentenses ? i know the number of lines by (wc -l) but the others i woundered about !! hope somebody teach me …

Member Avatar for esraa waqfi
0
85
Member Avatar for MCLASS80

I want to output results from a postgresql table into a csv file. I can do this however its also copying over headers and a row count. Im using \o /path then my sql query; Is there a way to get rid of the headers so i just have the …

Member Avatar for Watael
0
131
Member Avatar for k2k

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?

Member Avatar for shivemg
0
145
Member Avatar for John Linux

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 …

Member Avatar for histrungalot
0
253
Member Avatar for dwlamb

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

Member Avatar for dwlamb
0
124
Member Avatar for jino

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 …

Member Avatar for jino
0
206
Member Avatar for Rbezona

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 …

Member Avatar for JeoSaurus
0
120
Member Avatar for dwlamb

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 …

Member Avatar for L7Sqr
0
384
Member Avatar for freedomflyer

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 …

Member Avatar for chris.stout
0
181
Member Avatar for pennywise134

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 …

Member Avatar for chris.stout
0
125
Member Avatar for stevo7624

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 …

Member Avatar for stevo7624
0
292
Member Avatar for dwlamb

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 …

Member Avatar for chris.stout
0
82
Member Avatar for dwlamb

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?

Member Avatar for dwlamb
0
92
Member Avatar for dwlamb

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 …

Member Avatar for FelineHazard
0
152
Member Avatar for winky

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 …

Member Avatar for winky
0
473
Member Avatar for srinivas88

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 …

Member Avatar for L7Sqr
0
313
Member Avatar for MrHardRock

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 …

Member Avatar for Ezzaral
0
230
Member Avatar for abed1986

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 …

Member Avatar for abed1986
0
141
Member Avatar for Sundown G

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 …

Member Avatar for JeoSaurus
0
122
Member Avatar for enkitosh

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

Member Avatar for enkitosh
0
267
Member Avatar for dwlamb

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 …

Member Avatar for JeoSaurus
0
460
Member Avatar for griffman99h

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 …

Member Avatar for L7Sqr
0
308
Member Avatar for msrikanth

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 …

Member Avatar for JeoSaurus
0
265
Member Avatar for dinesh17

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 …

Member Avatar for JeoSaurus
0
185
Member Avatar for laalesh

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 …

Member Avatar for laalesh
0
84
Member Avatar for laalesh

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 …

Member Avatar for L7Sqr
0
68
Member Avatar for 4evrmrepylrning

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

Member Avatar for JeoSaurus
0
169
Member Avatar for C0ding

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 …

Member Avatar for C0ding
0
254
Member Avatar for rusman

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

Member Avatar for thines01
0
314
Member Avatar for Felipevd

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

Member Avatar for JeoSaurus
0
152
Member Avatar for msrikanth

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.

Member Avatar for msrikanth
0
2K
Member Avatar for java_programmer

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 …

Member Avatar for java_programmer
0
695

The End.