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 & ...
I have a file with data as below
* sub : A
* sub : B
* sub : C
I have to separate this data into 3 different files ...
I have a log file which prints the following lines:
01:15:21.882 DEBUG [SampleProcess]
01:15:21.882 DEBUG [SampleProcess1]
Sample Text1: 126
Sample Text2: 2330
Can anyone advise me on how to code a sed script that can be used to update a text file as follows:
Each time a line in the file containing the character string 'Header_one' is encountered:
- delete ...
need to print log file as per the field data present in file using awk. Sample log file data--
(First Field with c<0>---c--
I need to create temp directory in a specific location under var/www/html so anybody can download it for a several mins.
How can i do that?
mktemp -d generates under /tmp/xxxxx
I need to replace current value in configuration file with new value which is assigned to variable ,
needs to be replaced like
How do I make my train from the sl command look all rainbowy with the lolcat command?
sl | lolcat
grep -n "Table Structure" dumpfile.sql
XXXXXX:-- Table structure for table `table_name_1`
XXXXXX:-- Table structure for table `table_name_2`
XXXXXX:-- Table structure for table `...
how can I assign the output of the below command to a variable in a while loop?
echo $(( `date +%s` - `stat -L --format %Y $"/root/path/$output_file"` ))
This command checks the age of the file in a ...
I want to pass some host name which set as a autosys variable to the Python script as an input variable !
I don't want to run autorep -M [variable Name] in my Python script
Is there another way ?
I have huge csv files of size ~15GB in aws s3 (s3://bucket1/rawFile.csv). Lets say if the schema looks like this:
cust_id, account_num, paid_date, cust_f_name
1001, 1234567890, 01/01/2001, Jonathan
I want to run a script using function. Script runs fine as is but want to run using function and pass something as arg
# sample Korn shell profileument. ...
Is there a way to use echo to print text containing underscore next to a variable? For example:
$ echo "$var_name\_bar"
$ echo "$var_name""_bar"
I would like to ...
I have a below test ksh file
sqlplus -s << EOF
SET SERVEROUTPUT ON;
SET HEAD OFF
SET FEED OFF
SET DEFINE OFF
SET PAGES 0
SET COLSEP ";"
I have a .xml file that starts with:
<?xml version='1.0' encoding='UTF-8'?>
<domain xmlns="http://xmlns.oracle.com/weblogic/domain" xmlns:sec="http://xmlns.oracle.com/weblogic/security" ...
We're trying to connect to a server but it's having the below error:
Sep 26 11:00:38 server name: conn=******** fd=*** closed (TLS negotiation failure)
I would like to know if the TLS version ...
For my code , I have 5 logs generated for 5 different tables . I have to find for which table the records are not loaded correctly .
NWPR_TempLoad_CSP_11.log: 0 Rows not loaded due ...
I'm struggling to properly understand fork(), pipe(), and execvp() and would like guidance on where I am going wrong with this code, and where I should go from here. From my understanding, if you want ...
I'm executing my jar file which will create logs in the shell. My requirement is to search for a keyword,directly from the shell,without creating a log file.Executed using this code
I need to extract create table statments from below code.
rm -f tableNames.txt
rm -f HiveTableDDL.txt
beeline --showHeader=false --outputformat=tsv2 -u jdbc:hive2:// -n hive -e "show ...
I've got a file.sql file from an informix database export.
The following is a small part of the file (I changed the data a little bit to make it anonymous):
grant dba to "xxx";
grant dba to "yyy";
I want the diff between two timestamps which are available to me as list of strings.
date_list = ['Tue Sep 25 21:12:32 PDT 2018', 'Tue Sep 25 21:15:27 PDT 2018']
How do I get the difference in ...
I am trying to treat a series of integers as an array in order to extract the "columns" of interest.
My data after extracting a column of integers looks something like:
While reading the 2nd Column from the given file
I am facing issues while reading multiple columns using awk from the given file.
While reading column 2 the contents are shifting to the right.
I am testing the following code on both OpenBSD-current and Arch Linux (the kernel version is 4.18.9):
pthread_mutex_t mutex = ...
i have 2 text files 1.txt and 2.txt.
1.txt consists of names and ids separated by a tab, like so:
2.txt consists of ids ...
In rsyslog I am trying to search for a certain keyword in my log message and replace with another but seem to be running in to an issue. Looked around and found very few examples of this but couldn't ...
For a string like this,
I want to cut the string from last ...
For testing purpose, I need to set up Linux command alias like this:
alias 'dmidecode -t 1'='cat ~/test/system_info'
But the alias command doesn't work like this. It seems that the alias name should ...
I struggled to get this working but eventually got the script to execute a command (executing a sh script) on a remote unix server. I am trying to execute a second command and keep getting an error ...
I am trying to search for all files that contain exactly same id as listed in another file and put the file names in another file. I am using below command to find the files.
grep -w -f SearchList....
my teacher said that if the writing end of a pipe is closed, the child process can no longer read from the read end of the pipe and a read would generate a BROKEN _PIPE error. However, I can't get ...
When I use ftp to connect to other server, after connecting we are using below commands.
but now we have changed the process to sftp. If I gave the command prompt or hash after I ...
I need to transfer the Files from remote Linux server to directly HDFS.
I have keytab placed on remote server , after kinit command its activated however i cannot browse the HDFS folders. I know from ...
Have a application log file, getting log details continuously written from Application. It keeps logging multiple details.
Now need a standalone script, which will read this log file continuously and ...
Pretty simple idea that I'm sure somebody has come up with before. eg
command1 | tee > /dev/tty | command2
but with sockets instead of pipes. I'm trying to listen to the communication between two ...
I want to change
>lcl|ORF183:9482:8118 unnamed protein product
Keep everything after | and before 'white space', plus replacing second : to -
So far I'm doing it with ...
I'm trying to check when a client disconnects (closes connection) from the server.
I know that when a TCP connection is closed on one side read() on the other side returns 0 bytes, therefore I could ...
Say I have this pipeline:
pgrep -P $$ | xargs kill -INT; sleep 0.6; pgrep -P $$ | xargs kill -9;
what I want to do is avoid the sleep call if there are no arguments to xargs.
Something like this:
How Can I print a variable within another
should print : world
I can store it into third variable and print it ...
I have created a script that identifies a unique set of files (from a large list) and saves the file paths as unique variables (e.g. $vol1, $vol2, $vol3... see below).
for volume in `seq 1 $...
I'd like to have millisecond precision for my logging in my golang project, currently using log15 library
Problem is when I append it to Context, it rounds back up to seconds
I have comma separated (sometimes tab) text file as below:
with below code I try to loop through ...
I am working on AIX unix and trying to remove non-printable characters from file the data looks like in Arizona w/ fiancÃÂÃÂÃÂ in file when I view in Notepad++ using UTF-8 encoding. When I try to ...
For codeDeployment script, we provide Before-Install, After-Install scripts.
My requirement is to run After-Install script only once i.e. the script should be deployed on the server only for the first ...
I have a file that containes my target lines (start with '>') ...
>lcl|1:c127-20 Ricardo3 phone
I want to get :
My steps: (1) Change ':' with ' ', (2) remove string 'c' and ...
I'm trying to do a recursive text string search in UNIX and have the results show both the filename and line number on which the text appears within the file. Based on some other answers here I have ...
I'm moving a file between two folders in AWS. Using the CLI. I would like to pick Latest file and move it to a different folder. I solved the issue of picking latest file, however it gives me the ...
I have setup a Timesten client(220.127.116.11.0) on my unix machine.
I have setup a Timesten server on different machine.
After setup is complete I am trying to connect to Timesten database using JDBC ...
How to replace just a given characters at the end of a string with certain other characters, leaving the beginning of the line unchanged, for example:
In the string http://stack.kinokrad-co.com...