How to implement this?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to implement this?
# 8  
Old 10-20-2010
Thanks.. I was digging into that awk statement and how does it process each line.Wot i understood was..When line 1 get processed awk stores line 1 in memory as
Quote:
1,"A","B"
Now line 2..wher it gets stored as(RS in between)
Quote:
1,"A","B"
2,"C","D"
And the remaining lines.. alike..Pls tell how this stored in the reverse way in the memory.(i guess the trick is with RS- \n but not able to understand)
# 9  
Old 10-20-2010
It gets stored as 1,"A","B"\n after line 2, p contains: 2,"C","D"\n1,"A","B"\n

---------- Post updated at 12:36 ---------- Previous update was at 12:34 ----------

@Priyanka S, welcome to uni.com, but please don't piggyback on a thread. Start a new topic.

Moderator's Comments:
Mod Comment Thx Scrutinizer, I've already dealt with this

Last edited by bakunin; 10-20-2010 at 07:45 AM..
# 10  
Old 10-20-2010
MySQL

or alternative Smilie
Code:
# sed -e :a -e 'N;s/\(.*\)\n\(.*\)/\2\n\1/' -ne '$p;ta' file1

©ygemici - ®SED
# 11  
Old 10-20-2010
Code:
tail -r infile

# 12  
Old 10-20-2010
Code:
tail: invalid option -- 'r'
Try `tail --help' for more information.

# 13  
Old 10-20-2010
@Scru1Linizer

Yeah true

in any case, i am sure almost all (if not all) unix still have cat sort & cut Smilie

Code:
cat -n yourfile | sort -r -k 1 | cut -c8-


the tail -r works (at least) on SunOS (x86 and sparc)
yeah, tac is (at least) on linux

Code:
# tail -r tutu
tail: option invalide -- r
Pour en savoir davantage, faites: « tail --help ».
# tac tutu
4
3
2
1
toto
titi
tutu
# uname -a
Linux xxxxxxx 2.4.21-40.ELsmp #1 SMP Thu Feb 2 22:22:39 EST 2006 i686 i686 i386 GNU/Linux

Code:
# cat toto
tutu
titi
toto
1
2
3
4
# tail -r toto
4
3
2
1
toto
titi
tutu
# uname -a
SunOS xxxxx 5.10 Generic_141414-01 sun4u sparc SUNW,Sun-Fire-V490


Code:
# cat toto
tutu
titi
toto
1
2
3
4
# tail -r toto
4
3
2
1
toto
titi
tutu
# uname -a
SunOS xxxxxxxxx 5.10 Generic_142901-03 i86pc i386 i86pc

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Implement ps command in C

Hello, could anybody explain how the ps command works? I know something about the proc file system. But I'm still not sure about how it exactly works. Like ps without any option will print out the current user's processes, but it never displays my web browsers such as firefox or my LibreOffice... (3 Replies)
Discussion started by: freedombird9
3 Replies

2. Shell Programming and Scripting

How to implement scenario?

hi, i am having three files which is having following data file1: field1 field2 field3 1 A B 2 C D 3 E F file2: 4 G H 1 I J 5 K L file3: 4 M N (3 Replies)
Discussion started by: angel12345
3 Replies

3. Solaris

new - How i can implement Mirroring

Unix is something new for me, I trying learn about it now. I have download the sun virtualbox software and install solaris 10 into it. It is is like wizard with step by step installation guideline. :) NOw how can i implement mirroring(RAID) into the my new SunOS? can anyone give a briefly list... (14 Replies)
Discussion started by: webster5u
14 Replies

4. Shell Programming and Scripting

Trying to implement 'more' command

Hi all, i'm quite new in the UNIX world. So maybe i'm going to ask simple questions but they are unsolvable for me... I'm trying to implement the 'more' function or kinda of that, for improving my knowledges. But I encountered some problems that i hope u will help me to solve. The code i... (0 Replies)
Discussion started by: Cellofan
0 Replies

5. Shell Programming and Scripting

Trying to implement case

Hi All, My requirement is if the record is starting with 0, then do some processing. if starting with 1, some processing else (not with 0 or 1 ) then do some other processing. i tried the following case "$test" in /^0/) echo "starting with zero ;; /^1/) echo " with one" ;; *) echo... (3 Replies)
Discussion started by: ssunda6
3 Replies

6. Shell Programming and Scripting

Trying to implement case

Hi All, My requirement is if the record is starting with 0, then do some processing. if starting with 1, some processing else (not with 0 or 1 ) then do some other processing. i tried the following case "$test" in /^0/) echo "starting with zero ;; /^1/) echo " with one" ;; *) echo... (2 Replies)
Discussion started by: ssunda6
2 Replies

7. Shell Programming and Scripting

how to implement this

Hi all, could any of you please help me on my problem.. we are doing FTP (one report out put) from one server to another server through unix shell script program. Due to the network issues, some times FTP process is hanging. So we planned to modify the existing program with the following... (2 Replies)
Discussion started by: kishore_jasthi
2 Replies

8. Programming

how does va_arg implement ?

1 . How does va_arg implemented by system? (2 Replies)
Discussion started by: chenhao_no1
2 Replies

9. UNIX for Advanced & Expert Users

how can i implement rlogin

how can i use a rlogin with out entered a password, someone tell me about configure the next files /.rhosts /etc/hosts.equiv and /etc/hosts but i not sure about that, or there are not enough could you tell me how to do that? (3 Replies)
Discussion started by: jav_v
3 Replies

10. UNIX for Dummies Questions & Answers

how to implement diff

Hi Does someone know how Unix or Linux implement 'diff' command ? Any good reference or the algorithm will be better ? Thanks (3 Replies)
Discussion started by: harrylong
3 Replies
Login or Register to Ask a Question