Tagged Questions

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

learn more… | top users | synonyms (1)

0
votes
0answers
2 views

Autohot Key Equivalent?

Is there an equivalent product/method for AutoHot Key. For those that don't know, its a product that allows you to program your mouse movements and keyboard. This allows me to "macro" certain ...
0
votes
1answer
28 views

How can a script ask me questions?

I am using this script to analyse data: #!/bin/bash in=/autofs/cluster/transcend/mega/scripts/ insub=/autofs/cluster/transcend/mega/dtn/20141015/123 out=/autofs/cluster/transcend/mega/scripts/1256 ...
1
vote
3answers
42 views

Find and delete duplicate txt files

I have a folder with around 300 text files, is there any command that reads every every file indivdually and deletes the duplicate files? I mean the content and not the file names.
0
votes
2answers
22 views

Rename multiple files

Preface: I am an absolute novice with Linux, please don't judge strictly. I have a directory containing several images (over 100) of a .pnm extension. I wish to rename them in such a sense, that ...
0
votes
0answers
22 views

Need a script to send an email when an input has not changed for more that 30 minutes

I need a linux scrip that will send an sms when there is an input change and it has not gone to the initial state after 30 minutes, I have the following so far, but, I am sure there are few things ...
1
vote
1answer
30 views

How to execute recurring Bash script at specific times?

How would I set a script to execute on every Tuesday and Thursday at 11:50am? I've been looking at the at command, but I can't conceive how to use it the way I need to from its man page.
1
vote
1answer
37 views

Why I get unexpected end of file in my script when using gzip?

I have one doubt with this: for i in ./*.gz do gunzip -c $i | head -8000 | gzip > $(basename $i) done I get an "unexpected end of file" error for gzip, and I don't get the 8000 at all, only a ...
2
votes
1answer
52 views

How do I choose a file names with consecutive numeric suffixes?

I like to preserve things, so I want to preserve .bash_history. I would like to copy it into a directory using a script. Like here #!/bin/bash #Something here? number=~/Desktop/Coding/Bash\ ...
0
votes
1answer
19 views

transpose columns to rows in a spreadsheet [duplicate]

I have a spreadsheet has one column as the following: column A 1 a 2 b 3 c 4 d 5 e I want to ...
0
votes
2answers
65 views

Running Tasks in Parallel using Bash

I am using this script to analyse data. #!/bin/bash inlist=/aut/cl/tera/mja/scripts in=/aut/cl/tera/mja/data/ran_ready/ out=/aut/cl/tera/mja/data/mas/aft/ for i in $(cat $inlist/list.txt); do echo ...
0
votes
1answer
77 views

How to update files based on another file

I have 4 csv files and I want to update set of three based on values in the other one. The first 2 files (file_1 and file_2) contains names and their numerical ids. The third file (file_3) contains ...
0
votes
2answers
58 views

Split XML file into multiple files

I have an xml file that have different nodes, I want to split files like this: <unix> <mm> </unix> <osx> <nn> </osx> When I run the script I want it to make ...
1
vote
1answer
48 views

Convert XML to SQL INSERT statements using the command line

Is there a way to convert XML to SQL INSERT using the command line, here is examples: <something> <somthingelse>lol</somethingelse> </something> would be INSERT INTO ...
0
votes
2answers
36 views

Start/stop service script like Ubuntu for RedHat

Is there a .sh script that manages starting and stopping the service like Debian/Ubuntu but for Red Hat/Fedora? Looking to place it into the file running some software.
2
votes
3answers
103 views

Using grep/awk/sed to sort and combine 2 files

Ok I am running into a problem. I am taking a wifi log that has MAC addresses listed in it. I want to find out what MAC vendors/manufactors for the devices that are connected to my router. I have 2 ...
-2
votes
0answers
23 views

Need Script to Find Duplicate PID in a process [closed]

I need a Shell script to find the duplicate pids in the process. Please advise me Thanks, Srikanth.V
2
votes
2answers
14 views

How to resize only the missized images?

I have a directory with 10,000 JPEGs. I made a mistake while generating the files and now some are 720px × 480px, but they should all be 448px × 336px. The directory contains both the too large files ...
-2
votes
0answers
42 views

Sudo command not found, error in jenkins execute shell [on hold]

When I am executing a command in jenkins job (execute shell) with sudo, it throws an error like this: ..../bin/sh -xe /tmp/hudson7505852448142784880.sh + sudo whoami ...
0
votes
1answer
32 views

How to copy lines in awk command? (ksh scripting is preferred)

I have the below index file key1|1|1001 key1|1|2001 key2|2|3001 key2|2|4001 using this index file, I have to update my main file key1|1000|2000|3000|4000 key2|1000|2000|3000|4000 The ...
-1
votes
1answer
77 views

How to insert the entry into the newline?

I have the following entry in a tab delimited file test1.txt key1 10|15 20 30 11|xx 21 31 key2 527|240 269 0 0 0 2462 546 281 0 0 Is there any way I can transform this file into the below format? I ...
0
votes
0answers
44 views

sed: -e expression #1, char 4: unknown command:

Could someone tell me what does this reply mean ? sed: -e expression #1, char 4: unknown command: ` ' I get it when I use : sed -n "$num"p $javaFile >> ~/Desktop/$1_sql.txt for i in `seq 5 ...
0
votes
0answers
26 views

Copy old cert files and keep the directory path on server

I need to copy old certificate files to new temp directory but keep the directory structure. The certs files are in directories on the server and need to copy all to a temp folder before removing. So ...
0
votes
1answer
22 views

How to setup a display environment?

I'm using MNE (a program to analyse data) in Linux CentOS 6. I upgraded my system to Linux CentOS 7 and after that I was unable to run MNE GUI. Whenever I started the program I'd get the following ...
2
votes
2answers
37 views

saving the output of command line in a text file?

I am using the following command line to analyse data: unpackdcm -scr ${in} -targ ${out} This command is printing on the screen status and description about the progress in the job. In order to ...
2
votes
1answer
23 views

Script Saving the folders names in a text file?

I have a list of foldes in a parent folders how can I save all the folders names in one text file? as the following Parent folder |...A (folder) |...B (folder) |...C (folder) |...D (folder) |...E ...
1
vote
1answer
49 views

reboot in the middle of the script [closed]

I see sudo reboot in the middle of a script - meaning there are more commands after it. Is there any situation when the commands after reboot can be executed, assuming that reboot is not within an if ...
0
votes
0answers
28 views

Unix Shell script to delete all traces of itself after execution through crontab

My Question has 2 parts. Help with both parts is greatly appreciated. GIVEN INFO: - Lets assume there are 2 Folders, Folder A and Folder B. - Folder A contains many files. - Folder B contains the ...
3
votes
3answers
163 views

Count records matching pattern with Awk

So I was told to do last > lastloggedin which creates a file that shows the classes last login since the last system reboot, and now I am asked to write an Awk script which is named myawk that ...
3
votes
3answers
80 views

How to get whole command line from a process?

How can I get the command arguments or the whole command line from a running process using its process name? For example this process: # ps PID USER TIME COMMAND 1452 root 0:00 ...
1
vote
3answers
90 views

How to sum match numbers

I'm new at scripting, and need some help. Will appreciate your answers. I got this assignment, which is to find the sum of all five-digit numbers (in the range 10000 - 99999) containing exactly two ...
1
vote
1answer
10 views

Locating the terminal currently in use

I need to write a script to test if im using the correct terminal and then print a message This is what i have so far if(???? == dev/pts/1) echo Access Granted. Welcome. endif I dont know how to ...
8
votes
3answers
291 views

How can a Bash script tell how it was run?

I have a Bash script I was trying to make to help me run a rather complex command with small changes that it would ask me about through echo and read. I have found solutions to force it to run a ...
1
vote
2answers
59 views

How can a script run many processes at the same time?

I want my code to run many processes at the same time. The following example for a code and the source is StackExchange (Unix&Linux ) web site. > #!/bin/bash > for i in $(cat lis.txt); do ...
0
votes
4answers
87 views

Create a list of directories

I have a list of names in a text file (list.txt) I want to create a list of folders for the names included in that file. I wrote the following script, but it doesn't work and I don't know what is ...
0
votes
0answers
20 views

auto installing dropbox daemon(dropboxd) with profile signed in automatically script issue

I am trying to install dropbox automatically in my server auto-install script so when I spawn a new VPS instance I'm able to have dropbox installed and have the credentials already inputed via the ...
1
vote
2answers
67 views

Check that a bash script has exactly two arguments which are directories

I'm writing a bash script that compares two directories, but I'm not sure how to check conditions For example, if the user enters 1 arg instead of 2 (we need 2 since we're comparing two directories), ...
4
votes
2answers
187 views

Run script in a screen

I want to run a bash script in a detached screen. The script calls a program a few times, each of which takes too long to wait. My first thought was to simply open a screen and then call the script, ...
2
votes
2answers
50 views

How can I make a for loop starting a lot of processes?

I want to test some bug, and to do that I need to have a situation where the PID is larger than 99999. I am thinking of a bash script, a for loop. Any ideas?
0
votes
1answer
32 views

Another unterminated 's' command

I am trying to make a simple replacement for an IPv4 address script. sed "s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/192.100.100.100/g" This is what I have. As stated in the title I ...
2
votes
2answers
61 views

Compare 2 delimited files and output differences

I have asked similar questions here a couple times in the past with great success, but now my needs have slightly changed and I am struggling to get the exact output I am looking for. I would like to ...
2
votes
3answers
161 views

How do I tell which command has the longest manual on my system?

Is there an easy way to find out which command has the longest manual pages?
1
vote
3answers
136 views

bash script that reads user input and uses “cal” command to validate dates

I want to write a script that reads my input (for example if my script is called "check", then I would type "check 9 4 1993" and that input would go through the cal command and will check through the ...
1
vote
1answer
70 views

One-Click Script to Gmail Yourself a File

Does such a thing exist? I'd be interested in something like: You right-click a file in a file viewing manager, and click "gmail yourself this file". One click, and you're done. You open up the ...
0
votes
1answer
37 views

Shell script permission denied despite +x flag

This is an odd one, it only happens on one server (shared hosting, so I have limited access to configuration and logs), but I can't wrap my head around it. I have a shell script which runs some app's ...
1
vote
1answer
36 views

View timestamp for CUPS print jobs

I'm looking for a way to view the timestamp of a job in CUPS. I've searched the man pages and can't seem to find it. The long term goal is to have a script that parses the time from the jobID and ...
2
votes
1answer
52 views

Using rsync to copy from local to remote server with cronjob, asking for password

I want to copy files from a local machine to a remote machine. I have the command all set up and it looks like this: rsync -a project root@123.456.789.0:~ However, when running this command, I'm ...
-1
votes
1answer
63 views

just wanted to know what am i doing wrong in the end of this script that doesnt put my checkdate in to cal command

#Purpose: Validate a date #Usage: chkdate year month day # if [ $# -eq 0 ]; then echo Usage: chkdate year month day exit 0 fi year=$1; month=$2; day=$3; extra=$4 if [[ "$extra" != "" ...
12
votes
2answers
510 views

How does awk '!a[$0]++' work?

This one-liner removes duplicate lines from text input without pre-sorting. For example: $ cat >f q w e w r $ awk '!a[$0]++' <f q w e r $ The original code I have found on the internets ...
1
vote
1answer
44 views

How to write this replacement with condition

I want to replace now within my working directories the word -> with $\to$ if the word is not within verbatim environment. Pseudocode Replace all entriens of -> with $\to$ everywhere else but not ...
8
votes
2answers
501 views

How to non-invasively test for write access to a file?

In a shell script, how do I easily and non-invasively test for write access to a file without actually attempting to modify the file? I could parse the output of stat, but that seems really complex, ...