Sponsored Content
Top Forums Shell Programming and Scripting How to filter only comments while reading a file including line break characters. Post 302418241 by danmero on Monday 3rd of May 2010 03:30:37 PM
Old 05-03-2010
Both, my and Franklin52 solution work for me Smilie

Code:
# awk '$1!="#" && NF{gsub(/^ */,"",$0);sub("#.*",x);print}' file
one="1111111"
two="22222222"
three=333333333
# awk 'NF && $1 != "#"{sub("#.*","");sub(/^ */,"",$0);print}' file
one="1111111"
two="22222222"
three=333333333

 

10 More Discussions You Might Find Interesting

1. Programming

Reading special characters while converting sequential file to line sequential

We have to convert a sequential file to a 80 char line sequential file (HP UX platform).The sequential file contains special characters. which after conversion of the file to line sequential are getting coverted into "new line" or "tab" and file is getting distorted. Is there any way to read these... (2 Replies)
Discussion started by: Rajeshsu
2 Replies

2. Shell Programming and Scripting

Reading a path (including ref to shell variable) from file

Hi! 1. I have a parameter file containing path to log files. For this example both paths are the same, one is stated directly and the second using env variables. /oracle/admin/orcl/bdump/:atlas:trc:N ${ORACLE_BASE}/admin/${ORACLE_SID}/bdump/:${ORACLE_SID}:trc:N 2. I try to parse the path... (1 Reply)
Discussion started by: lojzev
1 Replies

3. Shell Programming and Scripting

Replacing characters in file with line break

Hi, Apologies if this has been asked before, but I searched and was not able to find an answer. It's probably a simple question to answer for those of you with some experience, though... I have a relatively long string where tokens are separated by the colon (':') character. Let's say the... (10 Replies)
Discussion started by: johnemb
10 Replies

4. UNIX for Dummies Questions & Answers

Reading a line including spaces

Hi All, I have a script that reads a file and echo it back to std out. Test.txt 1aaaaaaaaaaa . The script is ReadLine.sh #!/bin/ksh cat $1 | while read file do echo $file done I invoke the script as ReadLine.sh Test.txt The output that I get is (1 Reply)
Discussion started by: aksarben
1 Replies

5. Shell Programming and Scripting

Break line after last "/" if length > X characters

Hello. I am a french newbie in unix shell scripting (sorry if my english speaking is wrong). I have a file with path and filenames in it. I want to limit the number of characters on each line and break the line if necessary. But the "break" should occur after a slash caracter "/". Example of... (9 Replies)
Discussion started by: SportBilly
9 Replies

6. Shell Programming and Scripting

filter record from a file reading another file

Hi, I want to filter record from a file if the records in the second column matches the data in another file. I tried the below awk command but it filters the records in the filter file. I want the opposite, to include only the records in the filter file. I tried this: awk -F'|'... (8 Replies)
Discussion started by: gpaulose
8 Replies

7. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

8. Shell Programming and Scripting

Add line break for each line in a file

I cannot seem to get this to work.. I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application. the file looks like this this is a test that is a test balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies

9. UNIX for Dummies Questions & Answers

add a string to a file without line break

I searched and found "echo -n" and "printf" are solution for this, but they are not here: $ echo "hello" >> test $ cat test hello $ echo -n "world" >> test $ cat test hello world $ echo -n " seriously?" >> test $ cat test hello world seriously? This is not successful... (15 Replies)
Discussion started by: stunn3r
15 Replies

10. UNIX for Beginners Questions & Answers

Including Hash / in sed command filter

Hello All, I want to print data in between two lines in a file sample.txt through more or cat command on the screen. For that I am using below sed command to give the BEGIN and END text. Content of sample.txt server01:~ # cat /proc/mdstat Hello this is a text message 1 Hello this is a... (5 Replies)
Discussion started by: Xtreme
5 Replies
pfssize(1)						      General Commands Manual							pfssize(1)

NAME
pfssize - Resize frames SYNOPSIS
pfssize [--x <new_width>] [--y <new_height>] [--ratio <scale_ratio>] [--maxx <max_width>] [--maxy <max_heigh>] [--minx <max_width>] [--miny <max_heigh>] [--filter <filter-name>] DESCRIPTION
Resize all frames and all channels in the stream. Note that resampling is done on each channel as it is - for color images resampling is usually done in linear (not gamma corrected) XYZ color space. OPTIONS
--x <new_width>, -x <new_width> New x resolution in pixels. --y <new_height>, -y <new_height> New y resolution in pixels. --ratio <scale_ratio>, -r <scale_ratio> Resize both width and height using the given ratio. Ratio equal 1 is the original size, lower than 1 makes the frames smaller and greater than 1, enlarges the frames. --minx <max_width>, --miny <max_heigh> Make sure that the resulting image has at least <min_width> width and/or <min_height> height. Cannot be used in combination with -x, -y and --ratio. --maxx <max_width>, --maxy <max_heigh> Make sure that the resulting image has at most <max_width> width and/or <max_height> height. Cannot be used in combination with -x, -y and --ratio. --filter <filter-name>, -f <filter-name> Use filter <filter-name> for upsampling (on downsampling, box filter is always used). Available filters: BOX Box filter. This is the fastest and the filter, but it also causes visible aliasing artifacts. LINEAR (deafult) Bi-linear filter. MITCHELL Mitchell filter. From Mitchell and Netravali, Reconstruction Filters in Computer Graphics,In Computer Graphics, vol. 22 (4) 1988. Since the filter contains negative parts, it may cause halo artifacts and it may result in negative values for HDR images. EXAMPLES
pfsin memorial.hdr | pfssize -r 0.25 | pfsout memorial_small.hdr Lower the resolution of memorial.hdr four times. SEE ALSO
pfsin(1) pfsout(1) BUGS
Please report bugs and comments to Rafal Mantiuk <mantiuk@mpi-sb.mpg.de>. pfssize(1)
All times are GMT -4. The time now is 05:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy