Hi Members,
I've file named A200205__mlst__Staphylococcus_aureus__results.txt
It has column 1 as:
Quote:
Sample
A200205_GGTGAGTT_L007
I'm running below command:
Quote:
sed -ie s/out_paired_//g A200205__mlst__Staphylococcus_aureus__results.txt
It replaces out_paired_ in line 2 of column 1 to null.
I'm having the desired output, however, surprisingly a new file is created with name A200205__mlst__Staphylococcus_aureus__results.txte; i.e an extra e
I am unable to figure it out the cause of this hack!
I have created a sql file and it will create a HTML file with query result.But I'm unable to retrieve a html body in my email instead am getting a mail body with html tags.Please help
sql----
--sample HTML report.
--
-- Usage: sqlplus LOGON @script OUTPUT_FILENAME
--
-- Activate HTML output and configure the generated markup.
SET MARKUP HTML ON SPOOL ON -
HEAD '<title>My Report</title> -
<style type="text/css"> -
table { background: #eee; font-size: 80%; } -
th { background: #ccc; } -
td { padding: 0px; } -
</style>'
-- Dump results to the file that is given on the command line.
SPOOL &1
-- Only dump to file, not to the terminal.
SET TERMOUT OFF
-- Titles and formatting of columns.
COLUMN name HEADING 'Name'
--COLUMN job HEADING 'Job Title'
--COLUMN salary HEADING 'Salary' FORMAT $99,990
-- The query
--
select tablespace_name from dba_tablespaces;
/
-- Close file, which also closes the HTML tags.
SPOOL OFF
-- Back to non-HTML output
SET MARKUP HTML OFF
mailx command----
mailx -s 'file system' c.bambarandage@prima.com.lk < sam.html
Thanks,
Charith.
Hello. I am new to Linux and am looking for a solution to remove column 10 from a .csv data file as this column is causing me problems. Any help would be appreciated.
Thank you!
Hi All,
Using grep command with a defined string, you will get the row. Can I get the column instead of row? For example,
the file content is as below:
AA BB
123 456
789 ABE
execute 'grep ABE file' will give you "789 ABE". Is there any way to get the column:
BB
456
ABE
?
Thank you very much.
hi,
I am newbie in Linux shell scripting.Can anybody help me to check the presence of file identified by variable in Shell scripting?
For example: I am reading the content of a file using while command as below:
"while read -r line
do
code block
done < file_name"
Now in this case every line in file gets stored in the variable 'line' one by one.Problem here is every line in the file is nothing but the file_path of another file say xyz.txt and I am checking presence of this xyz.txt file using below command:
if [-f $line]
as 'line' is the variable which stores file path of xyz.txt but it is not working. It is unable to check the presence of this xyz.txt file as i am addressing it with the variable 'line'.
Please help me.Thanks in advance.
I have a little bash script that cats out a file and tells me if there is a line
where the 11th column has more than 6 characters in it.
It emails me where there is a bad line in a file - bead meaning that it will break a
donwstream process.
anyhow when i get the email saying that there is a bad file i just log in to the pc via
vpn and the I sed out the lines from the file that I get in the email. The bad lines are
always in danny.csv not danny1.csv
It has been the same lines killing the downstream process for a few weeks, so i put the "sed -i's" into
the script and it does it automagically.
[CODE]
for i in danny.csv danny1.csv
do
cat /come/and/play/with/$i | perl -ne 'print if length((split /,/)[10]) > 6' | mail -s "danny.csv bad line" casper@casperr.com
done
#it would be nice to find a perl change the file in place
sed -i '/D,642,0642,UBF,EVL,,M,,S,S,FOREVER,213,213,/d' /come/and/play/with/us/danny.csv
sed -i '/D,642,0642,UBF,EVL,,M,,S,S,QSP-U=C,4,4,/d' /come/and/play/with/us/danny.csv
[CODE]
However when a new line gets put into this file, I am going to have to log in and take out the line.
SO I have been trying to write a perl one liner that will edit the file in place, like sed, and make a
backup of the file. I just need a perl one liner that will delete any line where the 11th columns has more
than 6 characters in it.
[CODE]
perl -p -i.bak -e 's/\,\w{7}\,//g - which does not work.
[CODE]
I tried something like this:
[CODE]
perl -nle 'print if /\,\w{7}\,/' /come/and/play/with/us/danny.csv
[CODE]
but that does not catch the QSP-U=C and it catches more lines than just the
FOREVER. for a solutinog I need to focus on the the 11th column.
Hi all ,
I have a requirement where I have a file. Contents of the file are :
#comments
VAR="abg"
RES=123
#comments
IC6790ABG="https://www.abc.com"
IC5678-vg="https://www.bhy.com"
IC-gy_567:78="https://www.gyt.com"
#comments
The variable names can not have characters like - , : so
in this file I have to find words starting with IC and replace characters like - ,:
I want to change only the variable name , not the whole line.
I have used SED command
sed -i '/^IC/s/[^0-9 a-z A-Z _]*//g' file
when I am using this command , it is replacing the whole line
output becomes :
#comments
VAR="abg"
RES=123
#comments
IC6790ABGhttpswwwabccom
IC5678vghttpswwwbhycom
ICgy56778httpswwwgytcom
#comments
But I want the output like this :
#comments
VAR="abg"
RES=123
#comments
IC6790ABG="https://www.abc.com"
IC5678vg="https://www.bhy.com"
ICgy_56778="https://www.gyt.com"
#comments
How can I get the desired output , thanks for your help in advance .
I have Ubuntu 14.04. gedit is my preferred text and code editor. All of a sudden I am getting this warnng when I open a txt file:
Quote:
(gedit:3860): Gtk-WARNING **: GtkScrolledWindow 0x9bba3c8 is mapped but visible child GtkScrollbar 0x9bbc7a8 is not mapped
There are four such warnings in a row (or rather column). They litter my terminal output. What is this and how to correct it?
Thanks, - A.
I know that '>' and '>>' will redirect output to a file
However, how does one keep this output on the same line as the previous line?
'echo -n' will stop a trailing new line but for terminal redirection?
When working with a virtual terminal, I find it often easier to edit a file to execute than to construct a regular-expression etc. to inject the right UUID etc. into the command. I have run into an error while doing this. I suspect it is stems from quote mishandling, or improper escape sequences. (I ran directly from the command line earlier, forgot a quotation mark, and it gave a similar bad result.)
The program in question was efibootmgr. I had a file vaguely similar to this one, named efiboot.Hz:
Code:
efibootmgr -c -g -L "Debian (EFI stub)" -l '\EFI\debian\vmlinuz' -u 'root=UUID=$UUID ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img'
efibootmgr -c -d /dev/sdb -L "Debian Linux" -l '\EFI\debian\vmlinuz' -u 'root=UUID=1234-ffff-789 ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img'
Then I executed:
Code:
`tail -n 1 efiboot.Hz`
efibootmgr -v revealed the previous command produced a garbled name and boot options, and most importantly it didn't boot. Manually writing the last line on the terminal did produce the desired effect. I thought I checked the output from tail before putting the back-ticks.
What did I do wrong?
Hi Linux Experts,
I have the following problem to solve:
-Below is the CSV file give
firstname,lastname,password,username,notes,city,phonenumber
fred,smith, notgood1, fredsmith, this user\, is the first in this file, Brighton,345698
Peter, Bloggs, anotherbad,peterbloggs,,London,987123
Jo, cooper, notmuch, jcooper, this user is Jo, Brighton, 456987
john, carter,nearlyempty,jcarter,This note is actually very long\, but really doesn't say anything very useful,,345777
sam,jones,passing, samjones, Not much of a note really, Manchester, 135790
- capitalise the first letter of the two name fields
- sanitise the formatting
- move the username column to the beginning of each line
- the phone number is missing the area code - look up the city in the following table, and add it to the beginning of the phone number column:
City, Area Code
London, 5
Brighton, 6
Manchester, 7
Provide the corrected CSV file.
One of the problems I have is that whenever I use the comma as FS the output for column 5 is the following
cat Test.csv | awk 'BEGIN { FS = "," } {print $5 }'
notes
this user\
this user is Jo
This note is actually very long\
Not much of a note really
It stops in the middle of the entry because it sees the comma but what I am trying to achieve is to produce the full entry for column 5 like this:
this user\, is the first in this file
This note is actually very long\, but really doesn't say anything very useful
I have to probably escape somehow the FS in the text but so far no joy with completing this task. Also can you kindly help out for the rest of the requirements.
I really appreciate your help in advance.
Ivan