Sponsored Content
Top Forums Shell Programming and Scripting AWK "make a new column that include increasing numbers" Post 302643681 by tienete on Sunday 20th of May 2012 10:22:43 AM
Old 05-20-2012
Thank you Kevintse!!!!!!!!!!!!!!! i got it!
 

10 More Discussions You Might Find Interesting

1. Programming

how could i make a program mixed with many "|", "<" and ">"

I have written following code to do: ls -l | wc -w, it works: but when there are not only a single "|", if there are more such as: ls -l | sort -r | sort | sort -r, This program does not work, i want to know how could i deal with it when there are more "|", another situation is that, if it mixes... (2 Replies)
Discussion started by: strugglingman
2 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

4. Shell Programming and Scripting

Is there anyway to make awk "talks" to DB, say any awk-ODBC tools

Hi all, Is there anyway to make awk talk to DB ? So my awk script reads the data from some text file and eventually those data need to be stored in database. So is there anyway to do it in awk all tohether, say any awk-ODBC tool to make it work? (I really hate to write a cpp/java program... (4 Replies)
Discussion started by: qiulang
4 Replies

5. Shell Programming and Scripting

"Join" or "Merge" more than 2 files into single output based on common key (column)

Hi All, I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations: 1. I am restrained to 2 input files only. 2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Discussion started by: Katabatic
1 Replies

6. Shell Programming and Scripting

Make scipt except from "Y","y" and "yes" to take [Enter] as being "yes"

This is the script: #!/bin/sh if ; then rm -rf /usr/share/WallpaperChanger; fi if ; then rm -rf /usr/bin/wallch; fi; if ; then rm -rf /usr/share/applications/wallch.desktop; fi if ; then rm -rf /usr/share/doc/wallch; fi if ; then rm -rf /usr/share/man/man1/wallch.1.gz; fi echo "Delete... (4 Replies)
Discussion started by: hakermania
4 Replies

7. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

8. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

9. Shell Programming and Scripting

Substituting comma "," for dot "." in a specific column when comma"," is a delimiter

Hi, I'm dealing with an issue and losing a lot of hours figuring out how i would solve this. I have an input file which looks like this: ('BLABLA +200-GRS','Serviço ','TarifaçãoServiço','wap.bla.us.0000000121',2985,0,55,' de conversão em escada','Dia','Domingos') ('BLABLA +200-GRR','Serviço... (6 Replies)
Discussion started by: poliver
6 Replies

10. UNIX for Beginners Questions & Answers

awk script to "clamp" numbers.

Hello. I'm new to the command line and am self teaching how to use it. I have a .csv file that contains the following data: 5,10,15,30,8,3,9,10,11,3,12 I'm trying to write an awk script that will "clamp" a number that is > 10 to 10. (i.e. 30 will become 10 but 5 would stay as 5) The output is... (7 Replies)
Discussion started by: Eric7giants
7 Replies
nljust(1)						      General Commands Manual							 nljust(1)

NAME
nljust - justify lines, left or right, for printing SYNOPSIS
digits] seq] just] mode] order] margin] width] ck] [file ...] DESCRIPTION
formats for printing data written in languages with a right-to-left orientation. It is designed to be used with the and the commands (see pr(1) and lp(1)). reads the concatenation of input files (or standard input if none are given) and produces on standard output a right-to-left formatted ver- sion of its input. If appears as an input file name, reads standard input at that point. Use to delimit the end of options. formats input files for all languages that are read from right to left. For languages that have a left-to-right orientation, the command merely copies input files to standard output. Options recognizes the following options: Justify data for all languages, including those having a left-to-right text orientation. By default only right-to-left language data is justified. For all other languages, input files are directly copied to standard output. Select enhanced printer shapes for some Arabic characters. With this option, two-character combinations of laam and alif are replaced by a single character. Triggers ISO 8859-6 interpretation of the data. Processes digits for output as hindi, western, or both. digits can be or both. Use seq as the escape sequence to select the primary character set. This escape sequence is used by languages that have too many characters to be accommodated by ASCII in a single 256-character set. In these cases, the seq escape sequence can be used to select the non-ASCII character set. The escape character itself(0x1b) is not given on the command line. Hewlett-Packard escape sequences are used by default. If just is left justify print lines. If just is right-justify print lines starting from the (designated or default) print width column. The default is right justification. Replace leading spaces with alternative spaces. Some right-to-left character sets have a non-ASCII or alternative space. This option can be useful when filtering out- put (see pr(1)). With right justification, the option causes line numbers to be placed immediately to the right of the tab character. Without the option, right justification causes line numbers to be placed at the print-width column. By default, leading spaces are not replaced by alternative spaces. Indicate mode of any file to be formatted. Mode refers to the text orientation of the file when it was created. If mode is assume Latin mode. If mode is assume non-Latin mode. By default, mode information is obtained from the environment variable. Do not terminate lines containing printable characters with a new-line. By default, print lines are terminated by new-lines. Indicate data order of any file to be formatted. The text orientation of a file can affect the way its data is arranged. If order is assume keyboard order. If order is assume screen order. By default, order information is obtained from the environment variable. Truncate print lines that do not fit the designated or default line length. Print lines are folded (that is, wrapped to next line) by default. Expand input tabs to column positions k+1, 2*k+1, 3*k+1, etc. Tab characters in the input are expanded to the appropriate number of spaces. If k is 0 or is omitted, default tab settings at every eighth position is assumed. If cd (any non-digit character) is given, it is treated as the input tab character. The default for c is the tab character. always expands input tabs. This option provides a way to change the tab character and setting. If this option is specified, at least one of the parameters c or k must be given. Designate a number as the print margin. The print margin is the column where truncation or folding takes place. The print margin determines how many characters appear on a single line and can never exceed the print width. The print margin is relative to the justifica- tion. If the print margin is 80, folding or truncation occurs at column 80 starting from the right during a right jus- tification. Similarly, folding or truncation occurs at column 80 starting from the left during a left justification. By default, the print margin is set to column 80. Designates a number as the print width. The print width is the maximum number of columns in the print line. Print width determines the start of text during a right justification. The larger the print width, the further to the right the text will start. By default, an 80-column print width is used. EXTERNAL INFLUENCES
Environment Variables The environment variable determines the mode and order of the file. The syntax of is [mode][_order]. mode describes the mode of a file where represents Latin mode and represents non-Latin mode. Non-Latin mode is assumed for values other than and order describes the data order of a file where is keyboard and is screen. Keyboard order is assumed for values other than and Mode and order information in can be overridden from the command line. The environment variable determines the direction of a language (left-to-right or right-to-left) and whether context analysis of characters is necessary. The environment variable determines whether a language has alternative numbers. The environment variable determines the language in which messages are displayed. International Code Set Support Single-byte character code sets are supported. EXAMPLES
Right justify on a 132-column printer with a print margin at column 80 (the default): Right justify output of with line numbers on a 132-column printer with a print margin at column 132: WARNINGS
If with line numbers option) is piped to the separator character must be a tab(0x09). It is the user's responsibility to ensure that the environment variable accurately reflects the status of the file. Mode and justification must be consistent. Only non-Latin-mode files can be right justified in a meaningful way. Similarly, only Latin- mode files can be safely left justified. If mode and justification do not match, the results are undefined. If present, alternative numbers always have a left-to-right orientation. The command is HP proprietary, not portable to other vendors' systems, and will not be provided in future HP-UX releases. AUTHOR
was developed by HP. SEE ALSO
forder(1), lp(1), pr(1), strord(3C). nljust(1)
All times are GMT -4. The time now is 08:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy