Search Results

Search: Posts Made By: kraljic
6,516
Posted By kraljic
Print strings from a particular position in each line
I am using bash in Fedora 30

From the below lines (ls -l output), how can I print whatever is between the strings 'status_' and '.log'

$ ls -l | grep -i status
-rw-rw-r--. 1 sysadmin...
2,331
Posted By kraljic
Thank You very much Peasant. Hi Leo Will...
Thank You very much Peasant.
Hi Leo
Will try cat those files when I reach home. If I remember correctly, i couldn't cat those files even as root.
file command's output from my above post...
2,331
Posted By kraljic
Behaviour of echo commands used by Linux admins
version info : Fedora 28 (Kernel version: 4.16.12-300)
shell : bash

Using echo command , if I redirect a text like "Chocolate" to a file , all the contents in the file are overwritten as shown...
1,781
Posted By kraljic
Thank You guys. But none of the above solutions...
Thank You guys.
But none of the above solutions worked for me.
1,781
Posted By kraljic
Ok. After I set set -o vi how can I replace...
Ok. After I set set -o vi

how can I replace 2 which under the cursor with 7 ?
1,781
Posted By kraljic
Question on bash command line
OS : RHEL / Oracle Linux 6.8

In bash shell, how can I replace a character under the cursor with another character ?

In the below example , after I typed the following line, I realized that I...
1,620
Posted By kraljic
Delete all lines without a trailing semi colon
shell : bash
os : RHEL 7.2

I have a file like below

61265388
1-11Y5C-7690
1-11Y4Q-6763
INSERT INTO emp VALUES('oramds:test.xref','CBS_01','MIGWO161265388','61265388','N',SYSDATE);

INSERT...
1,869
Posted By kraljic
My for loop (shown below) deleted all the files...
My for loop (shown below) deleted all the files instead of renaming it :o

Any idea how I can do this correctly using a for loop (or any loop) ?
And how did my files get removed with the below mv...
1,869
Posted By kraljic
Rename multiple files in one go
OS : Oracle Linux 6.8
shell : bash

As shown below, I have multiple files like below (query1-extract_aa, query1-extract_ab, query1-extract_ac, ....)

$ ls -l
total 235680
-rw-rw-r-- 1...
958
Posted By kraljic
It worked. Thank You Ravinder
It worked. Thank You Ravinder
958
Posted By kraljic
Help with regular expression
OS version: RHEL 7.4
Shell : bash

I have a file which has lines like below. As you can see , they are SELECT queries.

SELECT * FROM S_DEALER_USER WHERE ROWNUM < 100;
SELECT * FROM ...
2,723
Posted By kraljic
Using tee command with ablity to provide input for prompts
OS version: RHEL 7.4
Shell : bash

I would like to capture command outputs using tee like # yum upgrade | tee yumupgradeLog

But, if I use tee command, I cannot respond to prompts like Is this...
3,909
Posted By kraljic
Split the text file into two
OS : RHEL 7.3

I have a file like below. I want to move (cut and paste) the first 7 lines of file1 to another file (file2).
How can I do this ? In my real life scenario, I will be moving first 12...
1,528
Posted By kraljic
How to generate a large file in Linux ?
RHEL 7.3

In Linux, how can I create a large dummy file which is 15GB in size ?
1,308
Posted By kraljic
You could be right Scrutinizer. All those lines...
You could be right Scrutinizer. All those lines except pc hello world comes from lsmod command in Linux. It could have leading spaces.

Hi MadeInGermany,
What does the 2 equal operators == in...
1,308
Posted By kraljic
Basic grep question
Shell : Bash shell (Fedora 26)

In the below text file (output.txt), I need to find all lines starting with the pattern pc. As you can see, only one line matches this condition (pc hello world)....
2,207
Posted By kraljic
Thank You Rudic. what does the sed clause /;...
Thank You Rudic.

what does the sed clause /; s/$/ do ?
2,207
Posted By kraljic
Replace string with lines stored in a file
OS version: RHEL 6.7
Shell : Bash


I have a file like below

$ cat pattern.txt
'T_PKT_HEADER'
'T_ORD_ITM_LOYX'
'T_ORDERITM_TRMS'
'T_ORDER_ITEM'
'T_ORDER_ITM_PRI'
'T_ORDER_ITEM_OM'...
12,874
Posted By kraljic
Brilliant. Thank You Prasanna. Thank You Rudic
Brilliant. Thank You Prasanna.
Thank You Rudic
12,874
Posted By kraljic
Hi Rudic, Already tried the following (no...
Hi Rudic,
Already tried the following (no single quotes). In this case, logfile is not generated at all !

spool /home/appusr/scripts/$dateString_batchtest3.log

Tried double quotes too (...
12,874
Posted By kraljic
Append date to sql*plus spool (log) file in shell script
SQL*Plus version : 11.2.0.4
OS : Oracle Linux 6.5

SQL*Plus is a client application to connect to oracle database. The log file for this tool is generated via spool command as shown below.

I am...
10,665
Posted By kraljic
Thank You drysdalk. In my real life...
Thank You drysdalk.

In my real life scenario, I have program being called inside script1.sh . This program doesn't take any input parameters.
Instead, it reads a config file (config.txt) and...
10,665
Posted By kraljic
How pass the input parameter to a file in the script ?
OS version: RHEL 6.7

myTextFile.txt file is referred within Script1.sh script,

I only execute Script1.sh and I want the input variable to be passed inside myTextFile.txt . Any idea how I can...
3,056
Posted By kraljic
Comma separated values to individual lines
My OS : RHEL 6.7

I have a text file with comma separated values like below

$ cat testString.txt
'JOHN' , 'KEITH' , 'NEWMAN' , 'URSULA' , 'ARIANNA' , 'CHENG', . . . .


I want these values...
3,851
Posted By kraljic
Remove trailing empty spaces within a quote
Platform: Oracle Linux 6.5
I have a file with hundreds of values enclosed in single quotes like below. I want the trailing empty spaces before the ending quote to be removed. Expected output shown...
Showing results 1 to 25 of 117

 
All times are GMT -4. The time now is 02:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy