Questions tagged [unix]

The Unix operating system is a general purpose OS that was developed by Bell Labs in the late 1960s and today exists in various versions. Important note: This tag is exclusively for programming questions that are directly related to Unix; general software issues should be directed to the Unix & Linux Stack Exchange site or to Super User.

0
votes
0answers
16 views

How can I get the number of rows inserted?

I'm working with CSV files to load my database with .tpt files in Unix. Is there any method to get the number of rows inserted on my tables? Like with any assistant, typical message X Rows Inserted. ...
0
votes
0answers
12 views

Converting ASCII file to UTF-8 in unix

I have a csv file that I transfer from 1 server to another using sftp. This file is in text/plain; charset=utf-8 encoding and contains special characters such as Ñ. Upon transfer the file encoding ...
1
vote
1answer
15 views

Does 'echo user:pass | /usr/sbin/chpasswd' override the root password?

On a work server I server I created a new user called Dev-admin. This user has Root permissions. The password was incorrect and needed to be changed. I ran the chpasswd command as seen below to ...
0
votes
1answer
12 views

how to pass parameters in shell script commands dynamically?

I want to call a shell script using java program and would like to pass parameters dynamically in one of the commands? Can anybody please help me with the java code.
0
votes
0answers
18 views

How exactly are anonymous pipes implemented in Solaris?

I'm trying to understand Unix pipes, and I can't find any information about Solaris anonymous pipes, which are created with something like pipe(2). As far as I know, system call creates buffer ...
-1
votes
2answers
31 views

Unix script to replace old date with current date dynamically in multiple files present in a directory

I am trying to work on a script where it is a *(star) delimited file has a multiple lines starts with DTP. I want to substring the date part and compare with today's date. If it is older than today, I ...
0
votes
0answers
9 views

Logrotate debug mode errors

I have the following logrotate script /path/to/folder { daily rotate 30 notifempty sharedscripts copytruncate compress dateext preremove if file --mime-type "$1" | grep ...
-1
votes
1answer
26 views

Making a new column out of specific lines from within a file?

I am trying to solve the following problem but several attempts have failed to get it right. Supposing I have the following in a file: a,b,c d,e,f g h I need some way to add g and h as a third ...
0
votes
0answers
9 views

Cannot Connect to MySQL local server with SequelPro MySQL said: Incorrect database name

I have create a mysql database locally in the unix macos Mojave environment, when entering mysql and entering command mysql> show databases; +--------------------+ | Database | +--------...
-1
votes
3answers
58 views

how remove break line with awk or sed?

I'm trying to remove the line break from a csv file 1 2010-01-08|2010|00360| PAPELETAS DE TRÁNSITO|.000|13.680 2 2010-01-08|2010|00367|30%) DEL ÁREA TOTAL DEL <--here LOCAL, MÓDULOS, STANS|.000|...
-1
votes
0answers
27 views

Why is this export command not exporting shell functions?

I had a bulk data file.i want to split 100 file . i got export an error. Error came (export: Illegal option -f) code: data=`awk 'END {print NR}' $DATADIR/data_cst_name_basics.tsv` echo $data l_upto=`...
-2
votes
1answer
19 views

/var directory is full. df command showing 98% filled. i.e. 9.5GB used out of 9.8GB. But du command showing only 2-3GB [on hold]

while checking the disk space using df -h command, I am getting output for /var directory as 98% filled and 9.5 GB used out of 9.8 GB. But when I checked the files and directory-wise space, I am ...
0
votes
3answers
43 views

Vim - E488 error - Trailing characters in search and replace command

The instructions say to: "Write a command that will change all "-" characters to "/" characters in every line that begins with an "F" or a "C" character." I tried this in Vim but I'm getting E488: ...
2
votes
1answer
45 views

Unix C unexpected behavior of pipes with scanf()

It's been a while since I last programmed in C, and I'm having trouble making pipes work. (For sake of clarity, I'm using Cygwin on Windows 7.) In particular, I need help understanding the behavior of ...
0
votes
0answers
13 views

How to Configure Eclipse.ini File to Mirror Shell Script To Enable TLS

I have a shell script that looks like: cd ~/git/Development/project/target java -Xmx4096m -Xms1024m -Djavax.net.ssl.trustStore=/etc/pki/java/trustStore.jks -Djavax.net.ssl.trustStorePassword=$(cat /...
-1
votes
1answer
18 views

Unix/Linux: Sorting by numbers after a comma

I am not very experienced with Linux/Unix, and I have a data file, with each line following the syntax of [name of a crime that was committed],[numberOfOccurences] For example, here are some of the ...
3
votes
6answers
62 views

Surround every line with single quote except empty lines

My goal is to add a single apostrophe to every line in the file and skip empty lines. file.txt: Quote1 Quote2 Quote3 So far I have used sed: sed -e "s/\(.*\)/'\1'/" Which does the job but ...
-4
votes
0answers
9 views

How to create logical volume

1) create new VM as below - 1 cpu - ram 1 G - hard disk 1 x 20G ( /dev/sda ; for install OS ) - hard disk 2 x 2G ( use for create datavg ) - hostname ---> srv + student ID ( example : srv42035000 ) - ...
0
votes
1answer
33 views

Remove Outlier Value from Text File

I need to detect and remove an outlier from a text file in Linux, perhaps using a standard deviation of some kind? vals.txt 57 60.95 61 66.80 74.42 <--- OUTLIER/BAD DATA After this, I need to ...
0
votes
3answers
30 views

AWK filter first and last row of given variable, discard the middle rows

I am trying to filter a file by selecting the first and last row of a given variable in a tab-delimited txt file using AWK. Tab-delimited file looks like this: 1 apple 30 2 apple 35 3 apple 36 ...
-5
votes
0answers
33 views

How to recive the information while doing git commit -m “” $M [on hold]

I have REQUIREMENT wherein i want to ensure that i would receive the following information while doing git commit -m "" $M $M is a variable that will provide the output in the JSON format of : M ="{...
0
votes
2answers
31 views

join command inserts matching fields as new rows, how can a single row per match be generated?

I'm trying to join tables with some shared fields into a single table. file1 looks like this: organism score_1 orgA 1 orgC 0 file2 looks like this: organism score_2 orgA 1 orgD 0 and I use the ...
2
votes
2answers
39 views

`waitpid()' always returns -1

I'm executing the code below and the call to waitpid() always returns -1, thus the code bellow ends with an infinite loop. The call works if I replace WNOHANG with 0. void execute(cmdLine* pCmdLine) {...
0
votes
8answers
74 views

How to extract codes using the grep command?

I have a file with below input lines. John|1|R|Category is not found for local configuration/code/123.NNN and customer 113 TOM|2|R|Category is not found for local configuration/code/123.NNN and ...
0
votes
0answers
25 views

How to find (programmatically) if child process is suspended\sleeping in c (unix)

I have to find status of child process (running/suspended/terminated) in a non blocking manner. I've found this code that helps me to detect if it is running/finished : #include <sys/types.h> #...
0
votes
6answers
93 views

How to use 'sed' to add dynamic prefix to each number in integer list?

How can I use sed to add a dynamic prefix to each number in an integer list? For example: I have a string "A-1,2,3,4,5", I want to transform it to string "A-1,A-2,A-3,A-4,A-5" - which means I want ...
-3
votes
1answer
47 views

Write a bash script that calculates the total number of hours worked [on hold]

Write a script using a Linux shell programming language to perform clock management for a small daycare. The program should manage all time in and out routines. At the end of the each day should give ...
0
votes
0answers
33 views

How to symboliclink .htaccess from one directory to another

I want to make /root/work/work/src/1800myeducation.com/public_html/.htaccess use the contents of /root/work/work/src/0rcan0mic.com/public_html/.htaccess I have read about: Unionfs - I don't think ...
0
votes
1answer
26 views

Error while trying to retrieve text for error ORA-01804 python in unix

I wanted to set the environment variables in the unix for my python scrippting project that uses cx_Oracle to connect with the database and have CRUD operations. i have used os.environ to set the ...
0
votes
1answer
58 views

Encountering Segmentation Faults while running very old C code

as a part of a Artificial Intelligence course, I am researching a Game solving bot (rolling stone) I found here. This code was written in 1999 (Probably on a HP UNIX workstation). I can't seem to run ...
0
votes
0answers
15 views

How to fix “struct 'FILE' has no member named'__pad'” error when using $make in apue.3e in ubuntu-18.10

I'm a newbie in learning APUE. And there are some errors I don't know how to fix when I'm using $make in apue.3e folder. By the way, I use ubuntu-18.10. buf.c:104:13: note: in expansion of macro ‘...
-2
votes
0answers
24 views

Is that possible to install and use an OS system such as Linux or Unix on my cloud drive?

Is that possible to install and use an OS system on my cloud drive?
1
vote
2answers
55 views

Converting date with timezone in UNIX timestamp Shell/Bash

I need to convert a date from string in the format "yyyy/mm/dd hh:mm:ss TZ" to UNIX time (TZ = Timezone). What I have done so far is to convert a date in the format "yyyy/mm/dd hh:mm:ss" without a ...
1
vote
1answer
16 views

Using find command to count certain type of executables

I'm trying to use Unix's find command to count the number of executable files in a directory of a certain type, namely Solaris(MSB) executable's. I know I can get the count of all executable files in ...
-1
votes
1answer
29 views

Hiding password field in command line

I am writing a system service on FreeBSD where I need to take user credentials to verify identity, something like this: ./compression_bin -i <input_file> --type=<type> --password=<...
4
votes
2answers
52 views

Why does /bin/sh hang when ran via execl on this particular script?

Can you give me some ideas on the following code? The code runs but it doesn't exit. The other string, s="ls -1" works well. Running the shell snippet via sh(1) works just fine also. #include <...
-1
votes
1answer
35 views

How to move a certain pattern of subfolders to another folder, keeping the structure using bash?

I have a set of folders like: /path/to/group1/folder/number123 /path/to/group1/folder/number456 /path/to/group2/folder/number123 /path/to/group2/folder/number456 /path/to/group3/folder/number123 /...
-1
votes
1answer
27 views

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set after chmod 755

What i tried is this: http://resolved-error.com/a/29903645/4983983 I executed this: n=$(which node); \ n=${n%/bin/node}; \ chmod -R 755 $n/bin/*; \ sudo cp -r $n/{bin,lib,share} /usr/local but now ...
0
votes
1answer
16 views

How to write a wrapper script in unix that calls other shell scripts sequentially?

I am trying to write a wrapper script that calls other shell scripts in a sequential manner There are 3 shell scripts that pick .csv files of a particular pattern from a specified location and ...
0
votes
0answers
32 views

UNIX Shell: Code in the else part doesn't execute however the condition is checked

I have a problem that when the file exists but is empty, i don't have a message " Le fichier file_name.txt est vide " , i get this message "Le fichier file_name.txt n'existe pas". The code is below ...
1
vote
1answer
43 views

In git when adding files, a number of files appear as different, what does the symbol @ mean when ls in terminal? [on hold]

In git when adding files, a number of files appear as different, what does the symbol @ mean when ls in terminal? For example, when running ls -lh, what does the @ symbol denote? This is run on MacOS ...
-1
votes
2answers
46 views

How to delete all directories except last 2 directories and the symlink pointed to those directories

I have below directory structure. ~/test_dir🍺$ls -lrt total 8 drwxr-xr-x 5 kk Users 160B Apr 17 23:53 app1/ drwxr-xr-x 5 kk Users 160B Apr 17 23:53 app2/ drwxr-xr-x 5 kk Users 160B Apr ...
1
vote
1answer
28 views

Is it possible to pause a command running under screen?

I'm running a long executing command (currently on day 7) under screen. I would like to temporarily suspend this command to perform some other computationally expensive operation and then resume the ...
0
votes
0answers
17 views

How to run a Control-M job that edits local file?

I have a cron job that looks like the follow: /directory_with_my_script_and_data_file/ ./process_things.sh ./things_already_done.txt It simply runs cd /directory_with_my_script_and_data_file &&...
0
votes
1answer
44 views

SSH with EOF correctly sets $PATH, but why doesn't it work without EOF?

I'd like to understand why ssh doesn't set the $PATH to whatever is determined in .profile, but seems to do it when ssh uses EOF. I'd like to run this line in my script: DIR_EXPANDED=`ssh $TOADDRESS ...
-1
votes
1answer
21 views

How do I replace (select current_timestamp) with a filename that houses this same select statement?

I am using PSQL. My command line is: $\copy (select current_timestamp) to '/home/myname/outputfile.txt' I would like to know, How do I replace "(select current_Timestamp)" with a filename that ...
0
votes
0answers
22 views

Logstash service stops alone after few seconds

I'm trying to configure for the first time ElasticSearch - Kibana - Logstash on my FreeBSD server. I installed Logstash with pkg. I wrote in /etc/rc.conf file: logstash_enable="YES" logstash_config=...
1
vote
2answers
97 views

How to limit number of CPU's used by a python script w/o terminal or multiprocessing library?

My main problem is issued here. Since no one has given a solution yet, I have decided to find a workaround. I am looking for a way to limit a python scripts CPU usage (not priority but the number of ...
0
votes
2answers
38 views

Way to append to file with echo command or other command without using ' ' or “ ” [duplicate]

I am trying to copy an entire script, not the script output but the entire script as a text line inside a file named test.sh. I am using another script to execute this so that is why I didn't use a ...
1
vote
3answers
29 views

How to sort files by modified timestamp in unix for a shellscript to pick them one at a time

I am writing a shell script that picks one file at a time and processes them. I want the script to pick files in the ascending order of their modified time. I used the code below to pick .csv files ...

http://mssss.yulina-kosm.ru