Search Results

Search: Posts Made By: ahmad.diab
1,071
Posted By ahmad.diab
you can use awk,nawk or gawk:- gawk...
you can use awk,nawk or gawk:-




gawk '{for(i=2;i<=NF;i++){print $1,$i}}' FS="," OFS="," infile.txt > outfile.txt



BR
:D:D:D
2,865
Posted By ahmad.diab
huaihaizi3:- what if "This is Line 1" is...
huaihaizi3:-

what if "This is Line 1" is containing more than 4 args?

---------- Post updated at 18:01 ---------- Previous update was at 17:49 ----------

or even you can do below:-

gawk...
2,865
Posted By ahmad.diab
and to eliminate the space from beginning do the...
and to eliminate the space from beginning do the code:-

gawk '/^R/&&s{sub(/^[ ]/,"",s) ; print s ; s=""}{s=s" "$0}END{sub(/^[ ]/,"",s);printf s}' file.txt
2,865
Posted By ahmad.diab
I am not facing this problem as per the o/p you...
I am not facing this problem as per the o/p you see , but modify code as below:-

gawk '/^R/&&s{print s ; s=""}{s=s" "$0}END{printf s}' file.txt
2,865
Posted By ahmad.diab
another way:- gawk '/^R/&&s{print s ;...
another way:-

gawk '/^R/&&s{print s ; s=""}{s=s$0}END{printf s}' file.txt


o/p
R|This is line 1
R|This is line 2
R|This is line 3
R|This is line 4
R|This is line 5


BR
;););)
8,238
Posted By ahmad.diab
sorry , but I didn't see your important note that...
sorry , but I didn't see your important note that the lines may contain another ":" , my first code will not work if this is true ,kindly use below python code:


import re

fin =...
8,238
Posted By ahmad.diab
you can use nawk , awk , gawk: nawk -F":"...
you can use nawk , awk , gawk:


nawk -F":" '{print $NF}' infile > outfile
8,433
Posted By ahmad.diab
just notice something , where is the call of the...
just notice something , where is the call of the function "PDFGenerator" ?
8,433
Posted By ahmad.diab
did you try to delete the space between #! and...
did you try to delete the space between #! and /usr/bin/env python ??




#! /usr/bin/env python

import subprocess
import sys

def PDFGenerator(args=''):
if args:
proc =...
3,277
Posted By ahmad.diab
actually if you want the number to be dynamic ,...
actually if you want the number to be dynamic , my code will be better if you do below:-

import re

x = '12345678911234567'
m = re.findall(r"(\d{1,3})",x[::-1])
y = ",".join(m)
result =...
3,277
Posted By ahmad.diab
using python 3.2:- import re x =...
using python 3.2:-


import re

x = '12345678911234567'
m = re.findall(r"(\d{2,3})",x[::-1])
y = ",".join(m)
result = y[::-1]
print(result)



output:

'12,345,678,911,234,567'


...
875
Posted By ahmad.diab
using Python32:- import re fin =...
using Python32:-


import re

fin = open('newfile.txt','r')
fout = open('file_out.txt','w+')
for line in fin:
print(line.replace(r'[|]','|').replace(r'{|}','\n'),file=fout)


fin.close()...
12,069
Posted By ahmad.diab
Just giving a shoot: :) Using Python3.2: ...
Just giving a shoot: :)

Using Python3.2:


f = open('/path/to/input/file.txt' , 'r')
matrix={}
f.readline()
for line in f:
(gene,sample,id) = line.split()
sample = sample.split(',')...
2,033
Posted By ahmad.diab
I think the second print is an extra one see o/p...
I think the second print is an extra one see o/p below , you need to remove it.

o/p

SQ kkk m99029 wwwAV
//
//
AS
DS
SQ ooo l9909 qqqqa
//
//

nawk '/SQ/ { P=1;print}; /\/\// { P=0};...
2,023
Posted By ahmad.diab
you can do below if interested with one liner:- ...
you can do below if interested with one liner:-

perl -07 -wlpe 's/(.*)\s+~+/## $1/s ;' infile.txt

:D:D:D
2,792
Posted By ahmad.diab
kindly refer to my reply in my second post to see...
kindly refer to my reply in my second post to see the comparison between soft and hard links
2,792
Posted By ahmad.diab
you can control the permission by using "chmod"...
you can control the permission by using "chmod" command , to create a soft link use "ln -s" command

---------- Post updated at 21:17 ---------- Previous update was at 21:15 ----------

Creating...
2,792
Posted By ahmad.diab
FYI:- A hard link can point only to a file...
FYI:-

A hard link can point only to a file and not to a directory, and only to a file existing on the same file system where the link itself is.
A symbolic link, in contrast, can point to a file...
4,597
Posted By ahmad.diab
thanks man that was helpful :b:
thanks man that was helpful :b:
4,597
Posted By ahmad.diab
trap command
dear all;
I can't under stand what does "trap" command do:
for example see below:
trap "echo; echo no interrupts >&2; sleep 3" 2 3 15

Plz , can any body explain the action of this command?...
Forum: Solaris 08-16-2011
12,091
Posted By ahmad.diab
thanks for all of you Gurus, I am really...
thanks for all of you Gurus, I am really appretiated.:)

BR
1,333
Posted By ahmad.diab
gawk '/^[0-9]/{a[$1]=a[$1]"\n"$2"\t"$3}END{for (i...
gawk '/^[0-9]/{a[$1]=a[$1]"\n"$2"\t"$3}END{for (i in a) print i,a[i]}' infile.txt
1,945
Posted By ahmad.diab
use below. gawk '/Alpha/||/Beta/{s= s ?...
use below.

gawk '/Alpha/||/Beta/{s= s ? s"|"$0 : $0 }/Gama/{print s"|"$0 ; s="" }' infile.txt

o/p:-
Alpha<>123|Beta<>456|Gama<>789
Alpha<>555|Beta<>666|Gama<>888

:)
3,676
Posted By ahmad.diab
your code is missing {} after -I see below :- ...
your code is missing {} after -I see below :-

echo archDP105144_1_702159963.dbf| xargs -I{} cp {} `echo {}|awk '{sub(/DP1/,"TML");print}'`

BR
3,422
Posted By ahmad.diab
see below link ...
see below link


http://search.cpan.org/~pajas/XML-LibXML-1.70/LibXML.pod#EXPORTS


and also view XML::SimpleObject module.
BR
Showing results 1 to 25 of 500

 

Featured Tech Videos

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