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)

2
votes
2answers
34 views

Match missing values in text files

Referring to this question : Finding missing value in text file i have 2 files containing below data example Name Feature Marry Lecturer Marry Student Marry ...
2
votes
1answer
52 views

Error passing variable from bash to php

I have the following files: vars.txt C=1234567890 Ascript.php #!/usr/bin/php <?php var $C="$argv[1]"; echo "\n $C \n"; $con = mysql_connect('localhost','root','123') or die ("No connected"); ...
1
vote
1answer
142 views

Nmap script execution to detect heartbleed is failing

Wanting to setup Nmap on my Ubuntu 14.04 LTS system to detect HeartBleed vulnerability. I followed the instructions here: ...
0
votes
3answers
45 views

Reduce length of specific column in delimited text file

I need for the 5th column in a delimited text file to be reduced to just the first 5 characters. All other columns must remain unedited. Input: file1.txt column1 column2 column3 ...
3
votes
2answers
94 views

Finding missing value in text file

I have a text file with following data. Name Feature Marry Lecturer Marry Student Marry Leader Bob Lecturer Bob Student ...
1
vote
1answer
28 views

Running for loop with two variables? [duplicate]

How can I run for loop with two variables or in other words is it acceptable to do that? I will clarify my question by the following example: I have a list of letters included in a text file ...
1
vote
0answers
35 views

Hotmail not receiving emails from a script, but works from the server

I have a working mail server running Debian stable, the following elements are working. SPF DKIM rDNS My IP is not listed in any backlist, I used: mxtoolbox.com for all this. My problem: Sending ...
2
votes
1answer
34 views

How can you get ping to print human readable timestamps?

Ping can print you a timestamp on every line but its in unix date format :( ping -D localhost PING localhost.localdomain (127.0.0.1) 56(84) bytes of data. [1415629479.482938] 64 bytes from ...
0
votes
1answer
25 views

running script with -o argument pointing to mount point of sd-card

I was trying to install Angstrom Linux on Colibri T_30 board---but I am stuck at one point where it specifies that run update.sh script with optional -o argument pointing to mount point of ...
2
votes
4answers
88 views

How to display the IP address of the default Interface with Internet connection?

I need to create a script that outputs the internal IP address, that is configured as the default Interface.
3
votes
1answer
55 views

Scan ~/Downloads on new file creation

I want all new files added to ~/Downloads (and sub-folders) to be scanned with clamscan. When using Firefox on other OSes/Machines I've noticed that downloaded files sometimes get automatically ...
15
votes
2answers
323 views

Using the setuid bit properly

I have a process that needs root privileges when run by a normal user. Apparently I can use the "setuid bit" to accomplish this. What is the proper way of doing this on a POSIX system? Also, how ...
1
vote
1answer
55 views

Get two values from command output in a bash script

I have a bashscript, which executes a command and calculates a pair of values, which output can look like this. a,b (10.0000000000, 10.0000000000) -> volt (2088133.7088034691, -222653.3238934391) ...
2
votes
5answers
149 views

Re-order text on each line in a file

I'm processing a log file and I need reorder each line (not sort). The log file looks like this: 11-06-2014 - 10:49:06PM lat = 41.858657; lon = -91.345142 11-06-2014 - 10:49:49PM lat = ...
6
votes
3answers
137 views

Get 100 palindrome numbers

I'm new at scripting and I have this assignment, which is to find 100 palindrome numbers with the following algorithm: Get a two-digit random number (greater than 10) Reverse the number Sum the ...
1
vote
2answers
67 views

identify harddrive before mounting

I've recently made 2 script that take care of mounting and dismounting a harddrive in linux. The thing that I could not figure out is the following. I am currently mounting /dev/sdc1 to ...
0
votes
1answer
27 views

Security concerns

I've recently been struggling with ways to make a easy way for my father to both mount and unmount a harddrive on a linux based system. I thought of a way to execute a shell script with PHP. The ...
0
votes
2answers
34 views

Transferring data between servers

I have SSH access between two servers A (httpmydocs) and B and I am transferring data routinely from A to B using the command line: scp -rpC /var/www/httpmydocs/* ...
2
votes
0answers
55 views

Copy folders at once

I want to copy a large number of folders at once not one by one. Is it correct to use the following code ? Is it helping to run the command cp for all the folders i at once? #!/bin/bash foreach i in ...
1
vote
0answers
108 views

How to Download the latest file from SFTP server?

I need to first get the data a file was uploaded to the sftp server on, then check whether it was today's date and if so download it else echo "File not found". I would like to do all this using a ...
1
vote
1answer
47 views

Bash Script - Controls on two directories [closed]

I would like to write a bash script that implements a command which takes two parameters. The two parameters must be pathname (absolute or relative) of two directories. The two directories are not to ...
2
votes
1answer
61 views

Simulate PrintScreen key press

I want to write a script that changes the window focus, and sends keyboard commands, such as print screen, and arrow keys, to the system. As in I need print screen to capture my desktop, not the ...
2
votes
2answers
61 views

Parse several thousand lines of txt into lines and columns

The file at hand lists names, credentials, roles, and privileges for thousands of users. It was passed onto me as .xls but the lines and columns are not arranged in proper form. I have reformated ...
0
votes
1answer
59 views

Shell string escape for command arguments [duplicate]

I'm trying to create "/tmp/pwet/foo bar" with this: DIR="/tmp/pwet/foo bar" ARGS="-p ${DIR}" mkdir $ARGS For integration reasons, I have to keep the ARGS building in 2 steps: ARG = some_options + ...
6
votes
4answers
584 views

Modify a file without creating another file

Is there a way to modify a file without writing the contents to other file, without sed and awk? For example, $ cat test.txt aaa aaa bbb ccc ddd Replacing using sed with -i option, sed -i ...
0
votes
1answer
30 views

Need to compare the two files and print all the columns then missing display as NA, then join another file [duplicate]

File 1: 123, 234 345, 789 678, 900 File 2 123, abc 345, dnc output (all columns in file1 and missing value in file two as NA): 123,234,abc 345,789,dnc 678,900,NA Output file add with another ...
0
votes
1answer
56 views

script to read certain key words in a document

I have a list of 50 folders. Inside every folder I have a text file contain key words and this file has the same name in all the folders but it has different values. How can a script read a certain ...
1
vote
3answers
58 views

Renaming directory bash script - target … No such file or directory

New to bash scripting, and just need a little help. I've been testing this on a simple directory structure. I'm trying to change any directory and/or sub directory with the name "Season" to "Sn". I ...
0
votes
2answers
80 views

Permission denied when run script via ssh

I wrote script which download via scp and install some packages. SSH keys are added to host and when I run [root@HostB ~]# ./myscript everything is ok and packages are downloaded via scp without ...
2
votes
3answers
27 views

Extracting time from logs using tcl, expect

I have logs with the following pattern: 1,30.10.2014,07:51:07,0,0,1,12,28,255,3,255,255,255,0,0,0; 2001,30.10.2014,07:51:07,0,0,0,300,5,0,255; I need to extract date and time... for the first line ...
1
vote
0answers
42 views

Neutralisation of data from Windows to Unix

I just noticed that other platforms files (Windows) had to cause me many bugs, like here, in my regexes. Mostly, the line ending ^M. There seems to be many ways to do dos2unix, like here described. ...
2
votes
1answer
56 views

How to run a program that has its own command line within a shell script program

I need to write a shell script to automatically run a set of files through an existing program ~1000 times. The program I'm trying to run them through is accessed through command line as follows, then ...
1
vote
0answers
16 views

Is there a way to run a script right after an account deactivated?

What I want to do is create a temporary user like this useradd -m -e 2009-12-01 -c "Temp Account" tempUser so that when the account expires (like this one would on December 1, 2009), the computer ...
1
vote
1answer
35 views

Find string in text file and execute a script depending of the result

I have a file (Data.txt) with something like this: A=1234597890 B=192.168.1.1 sometimes B goes first and sometimes only A or B. So, If I find: A, Print A content and execute A script B, ...
2
votes
1answer
54 views

how to use grep -v in an expect script

I'm new to expect scripting, trying to implement below command (that works otherwise) in an expect script $ grep -i cps config.cfg | grep -v "//cps" | grep -v "cps := 4.1" | \ grep -v "cps := ...
2
votes
1answer
46 views

Autohotkey Equivalent?

Is there an equivalent product/method for AutoHotkey. 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 functions ...
0
votes
1answer
52 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
88 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
36 views

Rename multiple files [duplicate]

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 ...
1
vote
0answers
44 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
77 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
91 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
71 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
23 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
73 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
85 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
178 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
121 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
68 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
223 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 ...