Sponsored Content
Top Forums Shell Programming and Scripting 1st column,2nd column on first line 3rd,4th on second line ect... Post 302619809 by batcho on Friday 6th of April 2012 08:05:39 AM
Old 04-06-2012
-bash-3.00$ awk 'NR%2{s=$0 ",";next}{print s $0}' infile>outfile
awk: syntax error near line 1
awk: bailing out near line 1

no good

---------- Post updated at 08:05 AM ---------- Previous update was at 08:03 AM ----------

Code:
sed -n 'h;n;H;x;s/\n/,/;p' infile


Looks good! thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to extract 3rd line 4th column of a file

Hi, Shell script: I would need help on How to extract 3rd line 4th column of a file with single liner Thanks in advance. (4 Replies)
Discussion started by: krishnamurthig
4 Replies

2. Shell Programming and Scripting

grep data on 2nd line and 3rd column

How do I grep/check the on-hand value on the second line of show_prod script below? In this case it's a "3". So if it's > 0, then run_this, otherwise, quit. > ./show_prod Product Status Onhand Price shoe OK 3 1.1 (6 Replies)
Discussion started by: joker_789us
6 Replies

3. Shell Programming and Scripting

get 3rd column of nth line

hi; i have a file.txt and its 9th, 10th and 11th line lines are: RbsLocalCell=S2C1 maxPortIP 4 (this is 9th line) RbsLocalCell=S3C1 maxPortIP 4 (this is 10th line) RbsLocalCell=S1C1 ... (11 Replies)
Discussion started by: gc_sw
11 Replies

4. Shell Programming and Scripting

Awk multiple lines with 4th column on to a single line

This is related to one of my previous post.. I have huge file currently I am using loop to read file and checking each line to build this single record, its taking much much time to parse those records.. I thought there should be a way to do this in awk or sed. I found this code in this forum... (7 Replies)
Discussion started by: Vasan
7 Replies

5. UNIX for Dummies Questions & Answers

Search word in 3rd column and move it to next column (4th)

Hi, I have a file with +/- 13000 lines and 4 column. I need to search the 3rd column for a word that begins with "SAP-" and move/skip it to the next column (4th). Because the 3rd column need to stay empty. Thanks in advance.:) 89653 36891 OTR-60 SAP-2 89653 36892 OTR-10 SAP-2... (2 Replies)
Discussion started by: AK47
2 Replies

6. Shell Programming and Scripting

Changing values only in 3rd column and 4th column

#cat file testing test! nipw asdkjasjdk ok! what !ok host server1 check_ssh_disk!102.56.1.101!30!50!/ other host server 2 des check_ssh_disk!192.6.1.10!40!30!/ #grep check file| awk -F! '{print $3,$4}'|awk '{gsub($1,"",$1)}1' 50 30 # Output: (6 Replies)
Discussion started by: kenshinhimura
6 Replies

7. UNIX for Dummies Questions & Answers

Want the UNIX code - I want to sum of the 1st column wherever the first 2nd and 3rd columns r equal

I have the code for the below things.. File1 has the content as below 8859 0 subscriberCreate 18 0 subscriberPaymentMethodChange 1650 0 subscriberProfileUpdate 7668 0 subscriberStatusChange 13 4020100 subscriberProfileUpdate 1 4020129 subscriberStatusChange 2 4020307 subscriberCreate 8831... (5 Replies)
Discussion started by: Mahen
5 Replies

8. Linux

Print the 1st column and the value in 2nd or 3rd column if that is different from the values in 1st

I have file that looks like this, DIP-17571N|refseq:NP_651151 DIP-17460N|refseq:NP_511165|uniprotkb:P45890 DIP-17571N|refseq:NP_651151 DIP-19241N|refseq:NP_524261 DIP-19241N|refseq:NP_524261 DIP-17151N|refseq:NP_524316|uniprotkb:O16797 DIP-19588N|refseq:NP_731165 ... (2 Replies)
Discussion started by: Syeda Sumayya
2 Replies

9. Shell Programming and Scripting

Solution for replacement of 4th column with 3rd column in a file using awk/sed preserving delimters

input "A","B","C,D","E","F" "S","T","U,V","W","X" "AA","BB","CC,DD","EEEE","FFF" required output: "A","B","C,D","C,D","F" "S", T","U,V","U,V","X" "AA","BB","CC,DD","CC,DD","FFF" tried using awk but double quotes not preserving for every field. any help to solve this is much... (5 Replies)
Discussion started by: khblts
5 Replies

10. UNIX for Beginners Questions & Answers

Compare 1st column from 2 file and if match print line from 1st file and append column 7 from 2nd

hi I have 2 file with more than 10 columns for both 1st file apple,0,0,0...... orange,1,2,3..... mango,2,4,5..... 2nd file apple,2,3,4,5,6,7... orange,2,3,4,5,6,8... watermerlon,2,3,4,5,6,abc... mango,5,6,7,4,6,def.... (1 Reply)
Discussion started by: tententen
1 Replies
jfs_mkfs(8)						     JFS file system creation						       jfs_mkfs(8)

NAME
jfs_mkfs - create a JFS formatted partition SYNOPSIS
jfs_mkfs [options] device [ blocks ] DESCRIPTION
jfs_mkfs is used to create (format) a JFS partition. jfs_mkfs must be run as root. device is the special file name corresponding to the actual device (e.g. /dev/hdb1) on which a JFS file system and/or JFS journal will be created. blocks is the number of blocks to be used for the file system. If omitted, jfs_mkfs automatically figures the file system size. The default block size is 4096. WARNING
jfs_mkfs will destroy all data on the specified device! OPTIONS
-c Check the device for bad blocks before building the file system. -j journal_device Create the external JFS journal on journal_device , create the JFS file system on device , and attach the external journal to the file system. -J journal-options Create the JFS journal on its own device or attach an external JFS journal to the JFS file system using options specified on the command-line. The following journal options are supported: journal_dev Create an external JFS journal on the given device. device=external-journal Attach an existing external JFS journal located on external-journal to the JFS file system that will be created on device. The external journal must already have been created using the command jfs_mkfs -J journal_dev external-journal Attach the external journal to the file system being created by using the command jfs_mkfs -J device=external-journal device Instead of specifying a device name directly, external-journal can also be specified by either LABEL=label or UUID=UUID to locate the external journal by either the volume label or UUID stored in the JFS external log superblock at the start of the journal. Use jfs_tune(8) to display a journal device's volume label and UUID. (See the -l, -L, and -U options of jfs_tune(8).) Only one of the journal_dev or device= options can be given per jfs_mkfs issuance. -L volume_label Set the volume label for the newly formatted device. If -L volume_label is used along with -J journal_device, the volume label of the specified external journal device will be set to volume_label. Otherwise, the volume label of the JFS file system will be set to volume_label. -O Provide case-insensitive support for compatibility with OS/2. -q Quiet execution - do not ask for confirmation before creating the file system. -s log_size Set the log size (in megabytes) of the inline log. If the -s option is not used, the default log size is 0.4% of the aggregate size. -V Print version information and exit (regardless of any other chosen options). EXAMPLES
Format 3rd partition on 2nd hard disk with the volume label "JFS_hdb3": jfs_mkfs -L JFS_hdb3 /dev/hdb3 Format 5th partition on 1st hard disk, verifying each block created: jfs_mkfs -c /dev/hda5 Format 3rd partition on 2nd hard disk as external journal, format 4th partition on 1st hard disk as JFS file system, and attach the exter- nal journal to the file system: jfs_mkfs -j /dev/hdb3 /dev/hda4 REPORTING BUGS
If you find a bug in JFS or jfs_mkfs, please report it via the bug tracking system ("Report Bugs" section) of the JFS project web site: http://jfs.sourceforge.net/ Please send as much pertinent information as possible including any error messages resulting from running jfs_mkfs. SEE ALSO
mkfs(8), jfs_fsck(8), jfs_fscklog(8), jfs_tune(8), jfs_logdump(8), jfs_debugfs(8) AUTHORS
Barry Arndt (barndt@us.ibm.com) William Braswell, Jr. jfs_mkfs is maintained by IBM. See the JFS project web site for more details: http://jfs.sourceforge.net/ March 9, 2005 jfs_mkfs(8)
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy