# Questions tagged [unix]

18571 questions

3

316

Views

### How to print first word of first line and last word of last line in unix in a file

Suppose there is a file file1.c It has 100 lines . I need to print first word and last word of that file.
user265906

2

42

Views

### Start two never ending python scripts

Is there a proper way to start two python scripts that will never end? I have a Bash Script.. I just want it to start two python server applications on different ports. But obviously as I get to the first python command, it will loop forever is there a way to kill these two python scripts when you k...
billybob2

3

57

Views

### grep for a variable that contains “+”

Trying to pickup the second row using grep and it dosent work if it has a '+' character i have tried with fgrep & instead of -P tried with Fx or x and -w but none of them worked. File prereq.txt contains this : WS+1 whatever 2222 WS--1...
Yashas K.M

2

48

Views

### Reproducibility issue of an openMP output

I am going through openMP tutorials and as I progressed, I have written an openMP version of a code that calculates PI by using an integral. I have written a serial version so I know the serial counterpart is ok. Once the openMP version completed, I noticed that everytime I run it, it gives me a di...
Fays

2

46

Views

### RegEx for a multiple line search and replace using sed

I need to have a RegEx that finds a \n in the middle of a line as a start point, anything before is random, and replace after 15 digits and 49 alpha on the second line. I need to replace all that by blanks, but the second line needs to join with the first one. Attempt sed -r -e '{N;s/\n[[:digit:]]{1...
Eric Charbonneau

2

69

Views

### Get Windows username from Bash Unix shell?

Is there a way to get the Windows' username of the user who's connecting to a specific Unix environment, using always the same server's credentials, directly in Bash? Some background There is a population of N users, who may connect to M different Unix environments always using the same credentials...
Matteo NNZ

2

32

Views

### how to insert line break after a specific string?

I have a file with the following text, I want to make a line break, after the S. character i have this 1900-01-01 00:00:00|1|S|S|S|S.1900-01-01|S.1900-01-01 00:00:00|1|S|S|S|S.1900-01-01 00:00:00|1|S|S|S|S. i want 1900-01-01 00:00:00|1|S|S|S|S. 1900-01-01|S. 1900-01-01 00:00:00|1|S|S|S|S. 1900-01...
Brayan Pastor

0

3

Views

Steveman30290

5

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

35

Views

Андрей Ка

1

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