10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
how to cut part of a string sing delimiter in reverse
input file
1,2,st-pa-tr-01,2,3,4,
2,3,ff-ht-05,6,7,8
how can i obtain strings till
st-pa-tr
ff-ht i.e cutting the last part og string -01 and -05
Thanks & Regards
Nivi
edit by bakunin: changed thread title (typo) (3 Replies)
Discussion started by: nivI
3 Replies
2. Shell Programming and Scripting
I'm trying to reverse every even line in my file using the awk command below but it prints only the odd lines but nothing else:
$ awk '(NR % 2) {print}; !(NR % 2) {print | "rev";}' myfile
Any idea what I might have done wrong?
Thank you. (10 Replies)
Discussion started by: ivpz
10 Replies
3. Shell Programming and Scripting
Hi am using unix aix
I have tried using awk but am getting only output = x ,its not incrementing next output
set -A var1 vv qa za
ct=0
i=3
while
do
var1=`echo ${var1}`
count=`awk ' NR==$i++ {print;exit}' ${.txt} | cut -c5 `
echo $count
let ct=ct+1
done (6 Replies)
Discussion started by: Venkatesh1
6 Replies
4. Shell Programming and Scripting
I may be making this too hard on myself, but I'm trying to find a way that I can use a cut or awk string to always remove the last two delimited fields of a string.
Say I have
PackageName-U939393-8.2.3.4.s390x.rpm
But the s390x could be any string w/o periods in it, x8664 for example,... (9 Replies)
Discussion started by: cbo0485
9 Replies
5. Shell Programming and Scripting
Hi,
I've a situation where,
a=xxx.yyy.zzz.txt
EXTN=`echo $a | cut -d . -f2`
Using the above code it delimites and will return "yyy.zzz.txt" to EXTN. But i need to get only the extension "txt". so as per the above code it delimits in the first "." itself. Can anyone help how to do... (6 Replies)
Discussion started by: skcvasanth
6 Replies
6. Shell Programming and Scripting
Hi, Guys. Please help me to find solution to this problem using shell scripting.
I have an INPUT file with 4 columns separated by tab. Each block of records is separated by -----
-----
Sample1 5402 6680 Pattern01
Sample2 2216 2368 Pattern02... (6 Replies)
Discussion started by: sam_2921
6 Replies
7. Shell Programming and Scripting
Hi Everyone,
I have one a.txt:
a b 001 c
b b 002 c
c c, not 002 c
The output should be
001
002
002
If i use cut -f 3 -d' ', this does not work on the 3rd line, so i thought is any way to cut the field counting from the end? or any perl thing can do this?:confused:
... (3 Replies)
Discussion started by: jimmy_y
3 Replies
8. Shell Programming and Scripting
dear all
i want to read 5th no of line from last line of file.
kindly suggest me possible ways.
rgds
jaydeep (2 Replies)
Discussion started by: jaydeep_sadaria
2 Replies
9. HP-UX
Hi,
I have a requirement to search for two words and grep all the lines between them. For e.g. :
$cat file.dat
abc,To,number
acd,To,cnz \* flexibile select *\
bcd,To,lla
anz,From,kln
app,From,lpz
I need to get all the lines between the lines cantaining word 'acd' and 'anz'.
the... (2 Replies)
Discussion started by: obedkhan
2 Replies
10. Shell Programming and Scripting
I have to extract data from a text file which is huge in size >>10GB.
ie between two strings. If I do an ordinary sed it takes forever to come out. I was wondering if there was anyway to do the entire process in reverse and on finding the relevant string is there any way to break out of the... (5 Replies)
Discussion started by: scorreg
5 Replies