Questions tagged [unix]

18560 questions
1

votes
1

answer
682

Views

Unable to create folder on Mac (El-Capitan), permission error

This simple error has me stumped: (0)[email protected]# mkdir ruby-2.0.0-p645 mkdir: ruby-2.0.0-p645: Operation not permitted (1)[email protected]# pwd /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 (0)[email protected]# Here is all the debug info I can think of...
Kashyap
1

votes
2

answer
536

Views

psinfo_t solaris does not contain full process name in its field

Not getting full process name in psinfo_t struct's field pr_fname while reading process info from psinfo data file(/proc/%d/psinfo) into struct psinfo_t from procfs.h in solaris. Full psinfo_t struct definition is present on below site: http://docs.oracle.com/cd/E19253-01/816-5174/6mbb98ui2/index.ht...
mSatyam
1

votes
1

answer
392

Views

R - how to convert JavaScript timestamp to human date time with as.POSIXct?

How can I convert a timestamp in this format to human date? I create the timestamp using javascript: Date.now(); Output example: 1468833354929 Then I store it in a db. So when I try to convert it with R: date
laukok
1

votes
5

answer
45

Views

How to add “/1/” as a line number in a txt file?

In Unix I want to add slash before and after the line number in a .txt file this command only shows the line numbers cat -n txt.file this: Tony Alpha Bravo to this: /1/ Tony /2/ Alpha /3/ Bravo
user10813205
1

votes
2

answer
47

Views

Splitting the first column of a file in multiple columns using AWK

File looks like this, but with millions of lines (TAB separated): 1_number_column_ranking_+ 100 200 Target 'Hello' I want to split the first column by the _ so it becomes: 1 number column ranking + 100 200 Target 'Hello' This is the code I have been trying: awk -F'\t' '{n=split($1,a,'_');for (...
Steveman30290
1

votes
5

answer
50

Views

UNIX average of specific employee as per designation

This is an example of a text file to be given as input Name,Designation,Salary Hari,Engineer,35000 Suresh,Consultant,80000 Umesh,Engineer,45500 Maya,Analyst,50000 Guru,Consultant,100000 Sushma,Engineer,30000 Mohan,Engineer,30000 My code should be able to run find the average salary of particular emp...
John Doe
1

votes
1

answer
35

Views

Write content into a file with bash script

I'm trying to create a bash script in order to daemonized celeryd task. In my bash script, I need to create some files and add content. This content have a variable given by user named $app_name with read method and some others variables in the content. Issue: When I copy the content located in my b...
Essex
1

votes
2

answer
85

Views

Need first two characters from a file and make sure that they both aren't below 6 then return line

I have a text file like this 17 Blue 45 Purple And I need to make sure the first two digits aren't both less than the number 6 and then print them. So, for example, the first line would print since the first digit 1 is lower than 6 and the second digit 7 is higher than 6, so they aren't both lower t...
serenitynow13
1

votes
2

answer
71

Views

Can I grep multiple AND arguments in if else?

I'm trying to grep multiple arguments in shell. I put orders like ./script arg1 arg2.. argN And I want them to act egrep -i 'arg1' mydata | egrep -i 'arg2' | ... egrep -i 'argN' | awk -f display.awk in order to match patterns in AND format. What's wrong in my process? Is it even right to code like...
Yusun Lim
1

votes
2

answer
798

Views

Don't understand CIRCUMFLEX use in this UNIX command ls -L | grep -v ^zip

ls -L | grep -v ^zip What i understand from this command is, it is doing a listing and piping the output to a grep command which performs grep on the received output file list to select any file with file name not containing text 'zip' and any file with file name containing text 'zip'. If this is co...
Oh Chin Boon
1

votes
1

answer
268

Views

Getting the wrong date from cell using PHPExcel

I'm using PHPExcel and trying to get the date values from the cells, but for some reason they give me the wrong date. $dt_column = $obj_sheet->getCell('A1'); $unix_date = PHPExcel_Shared_Date::ExcelToPHP($dt_column); $date = gmdate('Y-m-d 00:00:00', $unix_date); The file is in .xlsx format....
Theodor3gabriel
1

votes
0

answer
69

Views

After changes in pam crontab stop working

I have made changes in : cat /etc/pam.d/common-session-noninteractive sudo vi /etc/pam.d/cron sudo vi /etc/security/limits.conf after rebooting system crontab stop working when I check syslog it shows below error: PAM (cron) illegal module type: ession cron[4936]: Permission denied
Sandesh Dumbre
1

votes
0

answer
119

Views

Add new column in file using sed

I am trying to add a new column in a file and using below command got from another Stack overflow post: sed 's/$col/$col$FSEP$value/' $file > ${file%.*}'_m.txt' col=1 is column number, value=20171231 is the and FSEP=| is the field seperator. current data: '01 '|'name '|'address '|' phone number...
Explorer
1

votes
1

answer
39

Views

Want to write customized error and output function in shell script

I want to pass the standard error and standard output to userdefined function to write the custom logs OutputLogFile='OutputLogFilepath' ErrorLogFile='ErrorLogfilePath' //user defined function OutputLog() { echo $(DateTimeForLog)-$ScriptName-”information”-$1 >> $StdOutPutlogFile }...
Suganya
1

votes
0

answer
232

Views

grep command in json file

I am using grep command in a multiple json file which has content like this: 'Verdict': { 'Severity': '-1', 'Description': 'Some description' Reputation' } I want look for word Verdict and if it matches ,get the Severity number. So far I used: 'grep -A 2 -R \'Verdict\' path\to\file*.json\'|grep Se...
Piku
1

votes
0

answer
15

Views

Router dies on using Google Meet or Hangouts

I'm using Arch Linux on Lenovo Ideapad 520. Whenever I try to use Google Meet, my tplink router crashes and internet connection dies. I'm required to reboot the router for getting the connection back. Any help?
Souvik Haldar
1

votes
1

answer
52

Views

Bash Script Unstable Result

I have bash script and I put in the crontab. It runs every 10 minutes. When I run it manually, it gives perfect results. It creates '.tmp' files and these '.tmp' files are not empty, but Crontab results are not as I expected. it only creates '.tmp' files. Contents of '.tmp' files are empty. In this...
Umut TEKİN
1

votes
0

answer
379

Views

Running process 'as root' with setuid bit not working as expected - operation not permitted?

I have a program that captures network traffic off a network interface. (It's a C program sitting on libpcap.) I'm running Fedora 26. When I run the program as root, things look great: [craig ~]$ sudo su - [root ~]$ /home/craig/mybinary (output is as expected) But, when I run the program as myself (...
Craig Otis
1

votes
1

answer
59

Views

gcc showing errors from system library. -isystem doesnt work

Here is a simple (Deliberately wrong) c++ hello world program(https://pastebin.com/Cehm9yLx) #include using namespace std; int main() { int a; cout >> 'Hello World! Welcome!'
user9180468
1

votes
0

answer
278

Views

Cannsandra Driver & jnr-Unixsocket - java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider

I am using cassandra and jnr-unix socket in my project and both uses jnr-ffi. Not getting any error in my local, but getting error in test env. The versions are, Cassandra version - 3.3.2 jnr-unixsocket - 0.12 Error happens on calling UnixSocketChannel.open() from my code. Code from the hierarchy,...
user1578872
1

votes
1

answer
66

Views

sh script to replace text in multiple files

I am trying to replace every occurrence in a .prm file of the string '/net/origin/devdata1/slin' with '/tools/common/test/HATS' in over a hundred files using sed. I think I am having trouble with the proper syntax for a for loop that loops through different files in a directory(/home/AutoTest), and...
dhboots
1

votes
2

answer
213

Views

Clearcase copy files and folders to another location

I have one requirement where i need to copy Clearcase particular version's directory and subdirectory files to another location via python. When I used shutil.copytree function it copies the folders files but the problem is it creates the files as directory type. ex: source = 'testfolder/@@/main/1'...
user2660409
1

votes
1

answer
41

Views

read non-formatted column value

I am trying to read all values for 'Description 4' column. I can read it if all values are in same line and none of the values are empty but in below case some are empty values and some values are not oriented in same line as others. Please suggest how can i just pull all values below 'description 4...
ankitpandey
1

votes
3

answer
62

Views

replace variables of a file with reference to values in another file

I have two files file1.txt variable1=string1 with spaces characters variable2=string2 with spaces characters variable3=string3 with spaces characters file2.txt sometext1 textvariable1 sometext2 sometext3 variable2 sometext4 sometextcharactersvariable1 charactersvariable3 sometext5 variable2 ...........
venkatsai
1

votes
1

answer
49

Views

Automating build installation process

I work on a SaaS based product of my company which is hosted on private cloud. So every time a fresh BOM package is available by the DEV team. In the common share folder , we- the testing team installs the build on our application servers (3 multi node servers, with one being primary and the other t...
user3834797
1

votes
0

answer
66

Views

How to wait until mqueue creation is available?

I have to write program that heavily uses queues from mqueue.h. The problem is it can easily reach /proc/sys/fs/mqueue/queues_max limit which I cannot change. Is it possible to wait until creation of new queue is available without hard spinning? I mean something like do { desc = mq_open(name, O_CRE...
radrow
1

votes
1

answer
511

Views

Converting from UNIX Timestamp to datetime results in OSError: [Errno 22] Invalid argument

I'm retreiving an endpoint from an API that comes back as: Date(1516367982230) I named this SentDate in my script. The number between the brackets is a UNIX time stamp. I want to convert this to a normal date and time so I used a function I found on stackoverflow: SentDate = dt.datetime.fromtimestam...
Henk de Vries
1

votes
0

answer
30

Views

Compare 2 booleans and declare to variable

My problem is to compare 2 booleans and declare result into variable. variable=`function argument1` # 1 variable=`$variable || function argument2` if [ $variable == 'true' ] ; then do one else do another fi I need to execute function with argument2 and this function return true or false and need...
Андрей Ка
1

votes
1

answer
131

Views

Write logs to Unix box in Spring Boot Application

I want to deploy my spring boot application to a unix server and write logs to a specific directory on the server. Right now, I am able to write logs to my a log file in my spring boot app but it is inside my project. So my project exists in Project/myApp and logs are written to Project/myApp/logs/m...
T. Phillips
1

votes
0

answer
43

Views

Error with terminal command sox in Xcode C++ system()

Trying to run this code: system ( 'sox play -n synth 1.0 tri 1000.0' ); and get such error: sh: sox: command not found While executing this command in terminal all works fine (I have already installed sox). Xcode clang c++17 macOS High Sierra 10.13
Damirov Eldar
1

votes
1

answer
3.1k

Views

how to use environment variables in a .properties or a xml file

I am trying to configure my tomcat server.xml and I need to set value to something from a environment variable. I can't seem to find a way around from that. I know how to use values stored in a properties file but I can't set a variable to use my environment variable in a property file as well. is t...
Peyush Goel
1

votes
1

answer
34

Views

Change terminal tab name with ncurses in python

I use to change terminal tab names in python using: sys.stdout.write('\x1b]2;' + name + '\x07') Can this can be achieved while using ncurses? If not, is there any workaround?
derkomai
-1

votes
1

answer
23

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 --type= --password= Here, the secret key is used to authenticate user before compressing the given file. Currently, the secret key shows up in history which i...
Vishal Sahu
1

votes
1

answer
45

Views

Java shared Property File: Windows + Unix (generic)

So, in my departement, we got an Java application (running on Unix) which can be parametrised by an .property File. Inside this File, there are few refrences to other files (e.g. Log file path). Now, we need to use the same application on windows platforms. Everything works fine, until it should all...
Ronaldo-CH
1

votes
1

answer
193

Views

CPU Usage always > 100% for an application that has 100 threads and each thread reads log files in real-time using Apache Tailer

I have an application that reads log files in real-time. At any point it reads ~100 files. In my code there are 100 threads dedicated to each file to tail-listen the logs. I have deployed the application on a Unix Server with 4 cores, and I observe that the CPU usage is always > 100%. How should I r...
Ravikiran
1

votes
0

answer
133

Views

Objcopy equivalent command in Windows

Is there any way to rename the symbols in the library(*.lib file) in Windows? In unix, I used objcopy command as follows, objcopy --redefine-syms 'Renamed symbol' 'library path' I am searching for an equivalent command in windows. Thanks in advance.
subha
1

votes
1

answer
258

Views

Malformed packet in dns client implementation

Hi there for fun i'm developing a tiny dns client on a unix system. I've read the documentation about dns protocol i wrote a tiny function int makeQuestion(char* dns_addr,char *name){ int s = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); register int len_name = strlen(name); if(s
P.Carlino
1

votes
1

answer
348

Views

Sql query with Shell : Invalid option

So I'm trying to execute an SQL query (Oracle database) in my script shell. #!/bin/bash #!/bin/ksh login='mylogin' pss='mypassword' CE=`sqlplus -s $login/$pss
Med Anis
1

votes
0

answer
444

Views

Morse code ubuntu shell programming

I want to make a morse code converter that converts letters from a txt file to morse code and morse code from a txt file to letters The way of execution is ./morse.sh -e Text.txt(for encoding) and ./morse.sh -d Morse_text.txt (for decoding). My only problem is that the output is not displayed on the...
Zach DS UniPi
1

votes
1

answer
65

Views

bash pass pairs of argument in case statement

I am trying to find an efficient way to loop an action based on a pair of arguments e.g. (a, b, c, d, e, f....etc ) and (1,2,3,4,5,..... etc). The script should loop through a given folder of files, look for matching filenames and take action accordingly. However, the $dir1,$dir2,$dir3...etc has no...
StrangerThinks

View additional questions