Questions tagged [scripting]

A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

435 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
-1
votes
1answer
161 views

Shell script for telnet for multiple servers from text file

I am using below code for to telnet the multiple servers. file=ip.txt while read line do ip=$( echo "$line" |cut -d ' ' -f 1 ) port=$( echo "$line" |cut -d ' ' -f 2 ) if telnet $ip $port </...
-1
votes
1answer
43 views

How to create a new workspace through script?

I usually create new workspace whenever i start a new activity. Since i work on multiple task, i want to isolate them from one another. So every time i create a workspace, i have to do some set of ...
-1
votes
1answer
82 views

Script to change the timestamp of files according to filename

I'm in a macOS environment. I'd like to change the time stamp on multiple files that has names that starts with this format: XXXXX_DD_MM_YYYY_HH-MM-SS_ This is an example of a filename: CALLU_16-...
-1
votes
2answers
53 views

Creating config file with specified parameters

I want to create a config file that has parameters that can be specified using - or -- (without an equals sign), as well as the ability to output the file using - or --. Could somebody point me to a ...
-1
votes
1answer
40 views

Find Command, I want to use my variables

I have a script that creates a new directory based on User Input, and well as which directory contents it will copy over. Now here is where I am having issues, I have a find command that will replace ...
-1
votes
2answers
51 views

Shell script to match row number from one file and put it as comments in another file when match

I have two files. The content of both files has dynamic and generated by the system when required. The first file contains the meaning for specific row number as below : head simdb.txt MSISDN ...
-1
votes
1answer
96 views

Bash ignoring IFS

#!/bin/bash IFS="\n" cp -R "$oldpath/*" "$newpath/" I have a script which have to copy folders with spaces and other special characters in their names. + cp -R '/home/vmail/user@mail.com/Maildir/....
-1
votes
1answer
86 views

Data Comparison in 2 csv files columnwise, Input from 3rd file

I have 3 files: In file1 I've data like this A,B,C,D,E,F,G 1,2,3,4,5,6,7 7,6,5,4,3,2,1 In file2 I've data like this A,B,C,D,E,F,G 1,2,3,4,5,5,7 7,6,6,4,3,2,1 In file3 I've only one field i.e A: ...
-1
votes
2answers
74 views

Getting size of 40k paths from remote network

I've around 40k lines of file with paths which I need to take size from remote site (using rsh & du -scL command). I tried with while read line but due to remote connection, it exits after 100+ ...
-1
votes
1answer
167 views

script to add output from df -Ph

Would anybody have a quick script to add the used space out of a df command on Linux? I can do a RedHat rhel 6 but the rhel 5 switch for total is non-existent. I am looking to add the total of column ...
-1
votes
1answer
76 views

negation equivalence

I have this exercise: Write a script, which uses if-then-else-fi and accept sequence of parameters -a and -b with values "true" and "false", while for every pair writes negation of expression -a <=...
-1
votes
1answer
170 views

How to check if a directory exists I don't know the exact name of it with a bash script

I need to check if a directory already exists, in this case the one with a number suffix, and I won't know the exact number. Example directories to search: /usr/ names names.backup names.20160316 [...
-1
votes
2answers
54 views

Why would a user not be able to delete a file they created

Reposting the question about deleting a file. We have a script that is used to transfer files between two SCO Unix systems. The script has been rock solid for years. Recently the firewall unit at ...
-1
votes
1answer
5k views

How can I make a bash script that uses the ls -l command on a given argument?

How can I make a bash script that uses the ls -l command on a given argument? I have a text document containing my shebang ect... but when I add the ls -l command, it only works on my cwd. Say my ...
-1
votes
1answer
740 views

How to change shell from script

I want to change shell from ksh to bash and source the .kshrc file. I want to execute following lines of command sequentially: bash . ~/.kshrc clear Can anybody help me?
-1
votes
1answer
342 views

Trying to sum a decimal column from a csv file for each different vendor

I am trying to sum a column for each vendor in a loop. I apologize for the vagueness. I will try to explain. It is suppose to read from a file and based on the vendor name total the field labeled ...
-1
votes
1answer
89 views

Command output to file, new lines at beginning

I'm rewriting some 20+ year old Unix scripts and I want the output to go to the screen and a file. I know this is possible with tee. Is there a similar command that stacks new lines on top, at the ...
-1
votes
2answers
514 views

bash script user prompt for preferred directory

I am attempting my first bash script. I would like to prompt the user to find out where they would like a cloned repo to be saved. Currently I am assigning it like this. warpToLocation="${HOME}/apps/...
-1
votes
1answer
876 views

PuTTY and PowerTerm scripting Problem, Open a just in time URL via Samba share

I'm sshing into a fedora server using Powerterm (an expensive overly priced, license based, terminal emulator). The server uses an ancient form of (what I'm told is similar to) cobalt. I have no ...
-2
votes
2answers
295 views

how to remove all characters after and including “?” in filename?

I have a large amount of files that were downloaded and ended up having what looks like authentication parameters added to the filename which I would like to remove. Examples: file1.doc?...
-2
votes
3answers
204 views

Bash script to iterate record in file and extract value based on condition

Appreciate if any help for below query. Will require bash script. I am new to this scripting technology. I have the below file at some location - say filename as MemberFile.txt. # [ID ] #...
-2
votes
1answer
593 views

How to run list of commands in centos server?

I have few dedicated servers and couple VPS'es. I have to perform a list of copy paste commands (mostly) on all of them. Total commands are around 18, a few of them require manual entry my me though. ...
-2
votes
1answer
115 views

Holiday table make

I need script to convert this holiday list into date format. My input file MMYYYY CAL_B2K_ID 123456789012345678901234567890 ------ ------------ ------------------------------- 012016 821 ...
-2
votes
1answer
137 views

quick and easy way to comment out multi lined print statements

Is there a quick and easy way to comment out multi lined print statements? something like this? printf("3387 strings_line_tokens[lower_bound_of_big_boy_counter] %s \n", ...
-2
votes
2answers
406 views

extracting only the domainname, port number of first path

str1="https://111.111.111.111:2222/cpsess8993738132/scripts4/listaccts/" str2="https://111.111.111.111:2222/cpsess8993738132/" str3="https://111.111.111.111:2222/cpsess8993738132/cgi/server/xyz.cgi|...
-2
votes
2answers
159 views

How to delete a directory from terminal?

I'm trying to delete a directory after a series of events take place. That being said, I need to be able to place this in a file to execute once said events take place.
-2
votes
1answer
2k views

automatic capturing top output by cronjob CENTOS 6.5 x86_64

I have this command: top -n 14400 -a -b -d 1 > /toplogfile.txt I want to make a script which is run by cron every day to capture top output, and if it is possible gzip the output file after the ...
-2
votes
1answer
39 views

How to write a script to kill & clean the resources of executing process?

I have an application running in c language (my_process.c) and a script (stop_process.sh) to stop the application and clean up all resources held by the process. In the application code, let's say I ...
-2
votes
2answers
545 views

How to find the word before a match

I have the following log file. I need to know if there are any fault / suspect condition using a shell script. I need to find fault and check the previous word, if it is greater than 0 then there is ...
-3
votes
0answers
60 views

Validating all IP address using shell script by doing nslookup

Am doing the nslookup of DNS using script nslookup.sh which resolves only 1 IP at a time. If that scripts resolves any one IP out of 4 IPs it return true else it return fail when ip not resolved. I ...
-3
votes
1answer
85 views

Edit an EBS XML context_file to append a line after a particular one

I have a requirement where I need to add a new entry for the custom top to be created, in the context_file of ebs application installed in Oracle Linux 6. The context_file is an XML file. We need to ...
-3
votes
1answer
29 views

Running a command based on a file in the directory

I have some scripts setup that I would like a master script to call based on a files appearance in a directory. Basically I have what's show below. Script A uses file a Script B uses file b ...
-3
votes
2answers
83 views

Creating and executing a script

Given the task: Using head and tail, write a command to extract the second section of a file (i.e. the data section). *I have figured out that: tail -n 52 (path) | head -n 51 , will give me the ...
-4
votes
2answers
264 views

How to record the output of script to file but also keep it on screen?

How do I let my script not only output to screen but also record its output to a file? I want this to be done automatically within the script, rather than requiring the user to pipe the output through ...
-4
votes
1answer
74 views

SSH Script Joinning

Script1 for machine in host name; do ssh user@$machine /bin/bash << EOF uname -a lscpu | grep "^CPU(s)" grep -i memtotal /proc/meminfo EOF done Script 2 for machine in Host Name; do ssh ...