All Questions
4,892
questions
0
votes
1
answer
39
views
sed command is not replacing the files in my directory [duplicate]
When I run my bash script(given below) the files are not changed. The replacement does not happen for some reason. I am running the command as sudo, and the html folder has permssions 775 with the ...
1
vote
4
answers
93
views
linux extraction for log output not grouping correctly
I have a text file in which command output is copied. I need to parse the text files in separate columns.
I have the below data in a text file port.txt
NAME---SERIALNUMBER------FREE_PORTS
tx1 ...
3
votes
2
answers
99
views
sed can’t handle emojis
#!/bin/sh
emoji="\U1f300-\U1f5ff\U1f900-\U1f9ff\U1f600-\U1f64f\U1f680-\U1f6ff\U2600-\U26ff\U2700-\U27bf\U1f1e6-\U1f1ff\U1f191-\U1f251\U1f004\U1f0cf\U1f170-\U1f171\U1f17e-\U1f17f\U1f18e\U3030\...
0
votes
3
answers
73
views
linux command to replace linefeed happened in the middle of the string
Current file:
COl1,COl2,COl3,COl4,COL5
AAA1,AAA1,AAA1,AAA1,AAA1
BBB10,BB11
,BB22,BB33
BB44
CCCC,CCC1,CCC2,CCC3
,CCC4,CCC5
Expected:
COl1,COl2,COl3,COl4,COL5
AAA1,AAA1,AAA1,AAA1,AAA1
BBB10,BB11,BB22,...
-1
votes
2
answers
49
views
Need to Update the data of a ASOF_DATE column in a CSV file using shell script
I am trying to update the existing CSV file using shell script. There is a column called ASOF_DATE where am trying to replace the value of it with the current date. The shell script I am using is not ...
1
vote
2
answers
80
views
How to change the format of 1st and 5th date column from 28-MAR-2024 to 03/28/2024
Example Input File
AsofDate,Portfolio,Shock,CUSIP,DATE,BALANCE,INTEREST,SCHED_PRIN,UNSCHED_PRIN,LOSS
28-MAR-2024,INV,DN50,28623RAE8,22-APR-2024,25000000,447380,0,0,0
28-MAR-2024,INV,DN50,28623RAE8,22-...
0
votes
6
answers
104
views
linux command to prefix a value for all lines in a file except for first line and lines starting with hash symbol
Given a file input.csv as shown below,
EMP_ID,EMP_NAME,JOINING_DATE,SALARY
1,T Natarajan,22-APR-2024,6000000
2,Velmurugan,22-JUL-2024,2000000
3,Rowin,21-OCT-2024,5000000
#END_OF_FILE
how to prefix &...
-2
votes
7
answers
101
views
Copy data of a line in front of the data in the next line
Have data like
start {data}
target {ABC}
start {data2}
target {DEF}
target {GHI}
start {data3}
target {JKL}
....
I wish to move the {data} or {data2} which are after the keyword 'start' to their next ...
0
votes
1
answer
75
views
Bash pipe swallows exit code when pipe like sed or tee [duplicate]
I'm using turbo feature called turbo prune which creates folder out with partial copy of my monorepo, but unfortunately that means that when running in GitHub Actions commands like turbo run lint will ...
4
votes
6
answers
168
views
sed append a line to itself or awk $0 equivalent?
I have this text file containing a list like
name
surname
office
address
home_phone
office_phone
my_other_value
and I want to transform that to
'name':'Name';
'surname':'Surname';
'office':'Office';
'...
0
votes
5
answers
128
views
Delete first three lines containing a certain word
I am having a bit of trouble with a sed command. I need to delete the first 3 lines that contain a specified word from a file.
My sed command only checks the first 6 lines, whether or not they contain ...
0
votes
0
answers
35
views
How to use sed in shell script with value containing line break \n? [duplicate]
In my shell script I have conf=2bi5oIl0hldy/p3fe+KMQTVjUSg89ywhdMCaSOAopEVFM\nKlj4RDJcmNcEa1cgxL3sJNBHrw==\n
And I have a ini file that has parameter looks like this:
^PASS= SNlfkDahPoWNYCY0V+...
-3
votes
2
answers
74
views
Problems With Working With Columns, Changing Their Format
I have a file that contains a various number of lines to the likes of this.
05ALBUZZI CLAUDIA MARIA LBZCDM64M53F205R 236.41 197.01 6.70
My objective is, through ...
-1
votes
3
answers
47
views
sed command deleting content in the whole range while respecting the condition
There is a file of similar format:
# Lorem ipsum dolor sit amet, consectetur adipiscing elit.
# Donec vitae ex metus. Integer nec dui sit amet odio vehicula tincidunt ac eget justo.
#
[A8-LINER-...
0
votes
2
answers
156
views
sed/awk command to match a word in a file and then replace a line below that
I have a sample file:
- name: my-app
<<: *foo
installed: true
labels:
code: x.x
mode: y.y
set:
- name: a.b.c
value: abc-ab1cd2
- name: d.e.f
value: ab1cd2
I ...