how to add a colume with serial # in a file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to add a colume with serial # in a file
# 1  
Old 12-30-2010
how to add a colume with serial # in a file

I am working on a file, I need add a column with serial # in a file, the column will be the first column. and the serial # will be decide by each raw, say if I have 6 raws, I need serial # from 1 to 6 in the first column. Anyone know how to add that. I really appreciate. Thanks
# 2  
Old 12-30-2010
Code:
awk '{print NR,$0}' inputFile

This User Gave Thanks to anurag.singh For This Post:
# 3  
Old 12-30-2010
Thanks a lot!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add serial from second file

Hi all, please consider the following scenario. I have 979 csv files in a folder each with 3 lines, first line col2 has fixed value "a", second line col2 has "b" and third line col2 has "a/b". The first column has random names (no pattern). filename1.csvnamep1,a namep2,b... (1 Reply)
Discussion started by: jianp83
1 Replies

2. Shell Programming and Scripting

Extract data based on 2nd colume having double quotes

i want extract where the 2nd column having "3" or "7". Based on the forums tried like this but it is not working awk -F"," '$2=3;$2=7 {print}' filename Source "1","2","3","4" "1","3","3","4" "1","7","3","4" "1","8","3","4" "1","2","3","4" "1","2","3","4" Output : ... (5 Replies)
Discussion started by: onesuri
5 Replies

3. Shell Programming and Scripting

file transfer using AWK over serial port

I have a unix system that only has AWK to program with which hooks up to a windows or linux based system with all progamming and software capabilities. The link between the systems is typically a 9600 baud TTY port on the AWK system and COM1 on the other system. I can cat <filenm> from the unix... (4 Replies)
Discussion started by: bobfrog
4 Replies

4. Shell Programming and Scripting

add serial number begining of each line in a text file

Dear All, i am having text file below rama 123 done raju 456 not done keshav 123 done ............... ............ i want to add a serial number to this file, the output should be 1 rama 123 done 2 raju 456 not done 3 keshav 123 done 99 ............... 100 ............ ... (3 Replies)
Discussion started by: suryanarayana
3 Replies

5. SCO

Need some advice concerning file transfer with a serial connection

Hi, I have a SCO Unix ver 5.0.7 from which I need to get some files. The problem is that I'm working remotely (have no physical access) and using Dejawin because this server is only has a serial connection to a Windows machine. Ucopy isn't on the server. What I was thinking is to do a print... (5 Replies)
Discussion started by: spartanboy184
5 Replies

6. Ubuntu

Ubuntu 9.04 Serial application to telnet to serial device

Hello! I am working on an application which reads environmental instruments which have serial ports. The application requires a serial port to be present to talk to the device (i.e. /dev/ttyS0 ). In some instances the environmental devices will be 100's of yards away from the computer, so a... (5 Replies)
Discussion started by: mvona
5 Replies

7. UNIX for Advanced & Expert Users

convert one colume file to a one line, wrapped file.

I need to convert a file i.e cat list 1000: 1001: 1002: to cat wrappedfile 1000:1001:1002: currently I am using a while loop, paste and mv command to achieve desired outcome. touch wrappedfile cat list | while read line ;do echo $line > /tmp/$line;paste /tmp/$line wrappedfile >... (7 Replies)
Discussion started by: jouuu
7 Replies

8. SCO

Serial File Transfer

I need to transfer files from a sco/unix system to a windows xp system and they are only connected via a digiboard serial connection. The terminal emulation software connects and runs a program but I need to transfer files. Anyone know a good solution? (2 Replies)
Discussion started by: chansen
2 Replies

9. Shell Programming and Scripting

redirecting serial inputs to a file?

i have an external device sending serial messages i want to connect this device to a serial port in my sun blade box and record those messages to a file, how can i read the serial port and write it to file? Thanks (4 Replies)
Discussion started by: guilartec
4 Replies

10. HP-UX

add printer on serial port

I want to add printer on a serial port can I get full details of all parameters like baudrate, parity,flow control, ... Thanks (1 Reply)
Discussion started by: Hegazy Mahdy
1 Replies
Login or Register to Ask a Question