10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
awk '/^>/{id=$0;next}length>=7 { print id, "\n"$0}' Test.txt
Can I use substr to achieve the same task?
Thanks! (8 Replies)
Discussion started by: Xterra
8 Replies
2. Shell Programming and Scripting
I have a command like this:
listdb ID923 -l |gawk '{if (substr($0,37,1)==1 && NR == 3)print "YES" else if (substr ($0,37,1)==0 && NR == 3) print "NO"}'
This syntax doesn't work. But I was able to get this to work:
listdb ID923 -l |gawk '{if (substr($0,37,1)==1 && NR == 3)print "YES"}'
... (4 Replies)
Discussion started by: newbie2010
4 Replies
3. Shell Programming and Scripting
Hi to all,
I'm here again, cause I need your help to solve another issue for me.
I have some files that have this name format: date_filename.csv
In my shell I must rename each file removing the date so that the file name is filename.csv
To do this I use this command:
fnames=`ls ${fname}|... (2 Replies)
Discussion started by: leobdj
2 Replies
4. Shell Programming and Scripting
Hi
I have a script:
ls -l | grep "$TDATE" | awk '{print $NF}' > todays_files.txt
for run in $(cat todays_files.txt)
do
SSTR='expr substr "$run" 1 5'
echo "$SSTR"
done
I want 1 to 5 chars of each files.
It returns instead for all files.
'expr substr "$run" 1 5' (4 Replies)
Discussion started by: dipeshvshah
4 Replies
5. UNIX for Dummies Questions & Answers
can anybody explain this code?
thanks in advance..:) (6 Replies)
Discussion started by: janani_kalyan
6 Replies
6. Shell Programming and Scripting
Hi,
I have a long string like,
aabab|bcbcbcbbc|defgh|paswd123 dedededede|efef|ghijklmn|paswd234 ghghghghgh|ijijii|klllkkk|paswd345 lmlmlmmm|nononononn|opopopopp|paswd456
This string is devided into one space between substrings. This substrings are,
aabab|bcbcbcbbc|defgh|paswd123... (6 Replies)
Discussion started by: syamkp
6 Replies
7. UNIX for Dummies Questions & Answers
Hi,
My input file is
41;2;xxxx;yyyyy....
41;2;xxxx;yyyyy....
41;2;xxxx;yyyyy....
..
..
I need to change the second field value from 2 to 1. i.e.,
41;1;xxxx;yyyyy....
41;1;xxxx;yyyyy....
41;1;xxxx;yyyyy....
..
..
Thanks in advance. (9 Replies)
Discussion started by: deepakwins
9 Replies
8. Shell Programming and Scripting
What is the more efficient way to do this (awk only and default FS) ?
$ echo "jefe@alm"|awk '{pos = index($0, "@");printf ("USER: %s\n",substr ($0,1,pos-1))}'
USER: jefe
Thx in advance (2 Replies)
Discussion started by: Klashxx
2 Replies
9. Shell Programming and Scripting
Hi all,
I have a flatfile
I would like to get ext = 7950 , how do I do that ?
if ($1 == "CTI-ProgramStart") {
ext = substr($9,index($9,"Extension")+11,4);
But why it is not working ???? Please help .
Thanks (1 Reply)
Discussion started by: sabercats
1 Replies
10. Shell Programming and Scripting
Sorry if this has been posted before, I searched but not sure what I really want to do.
I have a file with records that show who has logged into my application:
2003-03-14:I:root: Log_mesg: registered servername:userid. (more after this)
I want to pull out the userid, date and time into... (2 Replies)
Discussion started by: MizzGail
2 Replies